linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: inside-secure: safexcel - fix memory allocation
@ 2018-10-08 19:17 Gustavo A. R. Silva
  2018-10-08 22:20 ` Kees Cook
  2018-10-10 13:55 ` Antoine Tenart
  0 siblings, 2 replies; 9+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-08 19:17 UTC (permalink / raw)
  To: Antoine Tenart, Herbert Xu, David S. Miller, Kees Cook
  Cc: linux-crypto, linux-kernel, Gustavo A. R. Silva

The original intention is to allocate space for EIP197_DEFAULT_RING_SIZE
*pointers* to struct, so sizeof(priv->ring[i].rdr_req) should be
sizeof(*priv->ring[i].rdr_req).

Addresses-Coverity-ID: 1473962 ("Sizeof not portable")
Fixes: 9744fec95f06 ("crypto: inside-secure - remove request list to improve performance")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/crypto/inside-secure/safexcel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index 86c699c1..bc6c5cb 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -1066,7 +1066,7 @@ static int safexcel_probe(struct platform_device *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) {
 			ret = -ENOMEM;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-10-18  6:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 19:17 [PATCH] crypto: inside-secure: safexcel - fix memory allocation Gustavo A. R. Silva
2018-10-08 22:20 ` Kees Cook
2018-10-16 19:44   ` Gustavo A. R. Silva
2018-10-17  6:17     ` Herbert Xu
2018-10-17  7:20       ` Antoine Tenart
2018-10-17 14:41         ` Gustavo A. R. Silva
2018-10-17 18:23           ` Kees Cook
2018-10-18  6:24             ` Gustavo A. R. Silva
2018-10-10 13:55 ` Antoine Tenart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).