linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: ishraq.i.ashraf@gmail.com
Cc: kbuild-all@01.org, gregkh@linuxfoundation.org,
	himanshujha199640@gmail.com, goudapatilk@gmail.com,
	insafonov@gmail.com, dan.carpenter@oracle.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	johannes@sipsolutions.net,
	Ishraq Ibne Ashraf <ishraq.i.ashraf@gmail.com>
Subject: [PATCH] staging: rtl8188eu: fix kzalloc-simple.cocci warnings
Date: Tue, 28 Nov 2017 16:00:56 +0800	[thread overview]
Message-ID: <20171128080056.GA1502@cairo> (raw)
In-Reply-To: <1511634581-997-1-git-send-email-ishraq.i.ashraf@gmail.com>

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@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.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;
 		}

  parent reply	other threads:[~2017-11-28  8:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23  1:29 [PATCH] staging: rtl8188eu: Fix private WEXT IOCTL calls ishraq.i.ashraf
2017-11-23 13:24 ` Dan Carpenter
2017-11-25  0:52 ` [PATCH 2/2] " ishraq.i.ashraf
2017-11-25  4:40   ` Dan Carpenter
2017-11-25 18:12     ` Ishraq Ibne Ashraf
2017-11-26  0:45     ` Ishraq Ibne Ashraf
2017-11-27 11:33       ` Johannes Berg
2017-11-25  1:29 ` [PATCH v2] " ishraq.i.ashraf
2017-11-25  4:55   ` Dan Carpenter
2017-11-25 18:29 ` [PATCH v3] " ishraq.i.ashraf
2017-11-25 21:25   ` Dan Carpenter
2017-11-27 11:24   ` Johannes Berg
2017-11-28  8:00   ` kbuild test robot [this message]
2017-11-28  8:00   ` kbuild test robot
2017-12-04 15:20   ` kbuild test robot
2017-11-26 20:45 ` [PATCH] " kbuild test robot
2017-11-26 23:20 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171128080056.GA1502@cairo \
    --to=lkp@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=goudapatilk@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=himanshujha199640@gmail.com \
    --cc=insafonov@gmail.com \
    --cc=ishraq.i.ashraf@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).