public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] s390/zcrypt: fix kzalloc-simple.cocci warnings
@ 2020-04-21 12:35 Zou Wei
  2020-06-08 14:27 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Zou Wei @ 2020-04-21 12:35 UTC (permalink / raw)
  To: freude, heiko.carstens, gor, borntraeger, linux-s390,
	linux-kernel; +Cc: Zou Wei

This patch fixes below warning reported by coccicheck

drivers/s390/crypto/zcrypt_ep11misc.c:198:8-15: WARNING:
kzalloc should be used for cprb, instead of kmalloc/memset

Fixes: 7384eb725e2d ("s390/zcrypt: add new low level ep11 functions support file")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 drivers/s390/crypto/zcrypt_ep11misc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/s390/crypto/zcrypt_ep11misc.c b/drivers/s390/crypto/zcrypt_ep11misc.c
index 004ce02..3c3d403 100644
--- a/drivers/s390/crypto/zcrypt_ep11misc.c
+++ b/drivers/s390/crypto/zcrypt_ep11misc.c
@@ -195,11 +195,10 @@ static inline struct ep11_cprb *alloc_cprb(size_t payload_len)
 	size_t len = sizeof(struct ep11_cprb) + payload_len;
 	struct ep11_cprb *cprb;
 
-	cprb = kmalloc(len, GFP_KERNEL);
+	cprb = kzalloc(len, GFP_KERNEL);
 	if (!cprb)
 		return NULL;
 
-	memset(cprb, 0, len);
 	cprb->cprb_len = sizeof(struct ep11_cprb);
 	cprb->cprb_ver_id = 0x04;
 	memcpy(cprb->func_id, "T4", 2);
-- 
2.6.2


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

* Re: [PATCH -next] s390/zcrypt: fix kzalloc-simple.cocci warnings
  2020-04-21 12:35 [PATCH -next] s390/zcrypt: fix kzalloc-simple.cocci warnings Zou Wei
@ 2020-06-08 14:27 ` Heiko Carstens
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2020-06-08 14:27 UTC (permalink / raw)
  To: Zou Wei; +Cc: freude, gor, borntraeger, linux-s390, linux-kernel

On Tue, Apr 21, 2020 at 08:35:48PM +0800, Zou Wei wrote:
> This patch fixes below warning reported by coccicheck
> 
> drivers/s390/crypto/zcrypt_ep11misc.c:198:8-15: WARNING:
> kzalloc should be used for cprb, instead of kmalloc/memset
> 
> Fixes: 7384eb725e2d ("s390/zcrypt: add new low level ep11 functions support file")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>  drivers/s390/crypto/zcrypt_ep11misc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, however without Fixes tag, since this was not a bug.

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

end of thread, other threads:[~2020-06-08 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-21 12:35 [PATCH -next] s390/zcrypt: fix kzalloc-simple.cocci warnings Zou Wei
2020-06-08 14:27 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox