[PATCH] s390/pkey: fix kzalloc-simple.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 0e0eec0b679eb48a3dc98c57fd6696178b58f331 Mon Sep 17 00:00:00 2001
From: Vasyl Gomonovych <gomonovych@xxxxxxxxx>
Date: Tue, 10 Oct 2017 23:48:33 +0200
Subject: [PATCH] s390/pkey: fix kzalloc-simple.cocci warnings

/drivers/s390/crypto/pkey_api.c:128:11-18: WARNING: kzalloc should be
used for cprbmem, instead of kmalloc/memset

 Use kzalloc rather than kmalloc followed by memset with 0

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
---
 drivers/s390/crypto/pkey_api.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index f61fa47..8dda5bb 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -125,10 +125,9 @@ static int alloc_and_prep_cprbmem(size_t paramblen,
  * allocate consecutive memory for request CPRB, request param
  * block, reply CPRB and reply param block
  */
- cprbmem = kmalloc(2 * cprbplusparamblen, GFP_KERNEL);
+ cprbmem = kzalloc(2 * cprbplusparamblen, GFP_KERNEL);
  if (!cprbmem)
  return -ENOMEM;
- memset(cprbmem, 0, 2 * cprbplusparamblen);

  preqcblk = (struct CPRBX *) cprbmem;
  prepcblk = (struct CPRBX *) (cprbmem + cprbplusparamblen);
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux