[PATCH 0/3] crypto: Use int type to store negative error codes

Qianfeng Rong posted 3 patches 4 weeks, 1 day ago
drivers/crypto/ccp/sev-dev.c           | 3 ++-
drivers/crypto/hisilicon/sec/sec_drv.c | 3 ++-
drivers/crypto/tegra/tegra-se-hash.c   | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
[PATCH 0/3] crypto: Use int type to store negative error codes
Posted by Qianfeng Rong 4 weeks, 1 day ago
The 'ret' variable usually is used to store returns from some functions,
which return either zero on success or negative error codes on failure.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

Change 'ret' from u32/unsigned int to int type.  No effect on runtime.

Qianfeng Rong (3):
  crypto: ccp - Use int type to store negative error codes
  crypto: hisilicon/sec - Use int type to store negative error codes
  crypto: tegra - Use int type to store negative error codes

 drivers/crypto/ccp/sev-dev.c           | 3 ++-
 drivers/crypto/hisilicon/sec/sec_drv.c | 3 ++-
 drivers/crypto/tegra/tegra-se-hash.c   | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.34.1
Re: [PATCH 0/3] crypto: Use int type to store negative error codes
Posted by Herbert Xu 2 weeks, 6 days ago
On Wed, Sep 03, 2025 at 09:25:34PM +0800, Qianfeng Rong wrote:
> The 'ret' variable usually is used to store returns from some functions,
> which return either zero on success or negative error codes on failure.
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing.  Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> Change 'ret' from u32/unsigned int to int type.  No effect on runtime.
> 
> Qianfeng Rong (3):
>   crypto: ccp - Use int type to store negative error codes
>   crypto: hisilicon/sec - Use int type to store negative error codes
>   crypto: tegra - Use int type to store negative error codes
> 
>  drivers/crypto/ccp/sev-dev.c           | 3 ++-
>  drivers/crypto/hisilicon/sec/sec_drv.c | 3 ++-
>  drivers/crypto/tegra/tegra-se-hash.c   | 3 ++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> -- 
> 2.34.1

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt