Skip to contentSkip to conversation

crypto: inside-secure: Fix sizeof() mismatch

PATCH In review Colin King 3 participants 3 messages Oct 10, 2020 – Oct 30, 2020

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 crypto: inside-secure: Fix sizeof() mismatch

From: Colin Ian King <[email protected]>

An incorrect sizeof() is being used, sizeof(priv->ring[i].rdr_req) is not correct, it should be sizeof(*priv->ring[i].rdr_req). Note that since the size of ** is the same size as * this is not causing any issues.

Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")

Fixes 9744fec95f06 ("crypto: inside-secure - remove request list to improve performance")
---
 drivers/crypto/inside-secure/safexcel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/inside-secure/safexcel.c +1 -1
index eb2418450f12..2e1562108a85 100644
@@ -1639,7 +1639,7 @@ static int safexcel_probe_generic(void *pdev,
 
 		priv->ring[i].rdr_req = devm_kcalloc(dev,
 			EIP197_DEFAULT_RING_SIZE,
-			sizeof(priv->ring[i].rdr_req),
+			sizeof(*priv->ring[i].rdr_req),
 			GFP_KERNEL);
 		if (!priv->ring[i].rdr_req)
 			return -ENOMEM;
Signature · 1 line
2.27.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoting Colin King (2020-10-10 18:47:36)

Quoted 10 lines

From: Colin Ian King <[email protected]>

An incorrect sizeof() is being used, sizeof(priv->ring[i].rdr_req) is not correct, it should be sizeof(*priv->ring[i].rdr_req). Note that since the size of ** is the same size as * this is not causing any issues.

Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")

Fixes 9744fec95f06 ("crypto: inside-secure - remove request list to improve performance")

Thanks!
Antoine

Quoted 20 lines
---
 drivers/crypto/inside-secure/safexcel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/inside-secure/safexcel.c +1 -1
index eb2418450f12..2e1562108a85 100644
@@ -1639,7 +1639,7 @@ static int safexcel_probe_generic(void *pdev,
 
                priv->ring[i].rdr_req = devm_kcalloc(dev,
                        EIP197_DEFAULT_RING_SIZE,
-                       sizeof(priv->ring[i].rdr_req),
+                       sizeof(*priv->ring[i].rdr_req),
                        GFP_KERNEL);
                if (!priv->ring[i].rdr_req)
                        return -ENOMEM;
Signature · 1 line
2.27.0
maintainer
#2 lore raw
In reply to Colin King
Quoted 7 lines · Colin King

From: Colin Ian King <[email protected]>

An incorrect sizeof() is being used, sizeof(priv->ring[i].rdr_req) is not correct, it should be sizeof(*priv->ring[i].rdr_req). Note that since the size of ** is the same size as * this is not causing any issues.

Quoted 6 lines

Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")

Fixes 9744fec95f06 ("crypto: inside-secure - remove request list to improve performance")
---
 drivers/crypto/inside-secure/safexcel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt