[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171128080056.GA1502@cairo>
Date: Tue, 28 Nov 2017 16:00:56 +0800
From: kbuild test robot <lkp@...el.com>
To: ishraq.i.ashraf@...il.com
Cc: kbuild-all@...org, gregkh@...uxfoundation.org,
himanshujha199640@...il.com, goudapatilk@...il.com,
insafonov@...il.com, dan.carpenter@...cle.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
johannes@...solutions.net,
Ishraq Ibne Ashraf <ishraq.i.ashraf@...il.com>
Subject: [PATCH] staging: rtl8188eu: fix kzalloc-simple.cocci warnings
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:3379:36-43: WARNING: kzalloc should be used for pwep, instead of kmalloc/memset
Use kzalloc rather than kmalloc followed by memset with 0
This considers some simple cases that are common and easy to validate
Note in particular that there are no ...s in the rule, so all of the
matched code has to be contiguous
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Fixes: f1ac2c75e0c6 ("staging: rtl8188eu: Fix private WEXT IOCTL calls")
CC: Ishraq Ibne Ashraf <ishraq.i.ashraf@...il.com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
---
ioctl_linux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -3376,14 +3376,13 @@ static int rtw_set_encryption_pvt(struct
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + offsetof(struct ndis_802_11_wep, KeyMaterial);
- pwep = (struct ndis_802_11_wep *)kmalloc(wep_total_len, GFP_KERNEL);
+ pwep = kzalloc(wep_total_len, GFP_KERNEL);
if (!pwep) {
DBG_88E(" r871x_set_encryption: pwep allocate fail !!!\n");
ret = -ENOMEM;
goto err_free_param;
}
- memset(pwep, 0, wep_total_len);
pwep->KeyLength = wep_key_len;
pwep->Length = wep_total_len;
}
Powered by blists - more mailing lists