From: Thomas Meyer <thomas@m3y3r.de>
To: Greg Kroah-Hartman <gregkh@suse.de>,
Larry Finger <Larry.Finger@lwfinger.net>,
wlanfae@realtek.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] staging: rtl8192e: Use kzalloc rather than kmalloc
Date: Tue, 08 Nov 2011 20:17:11 +0100 [thread overview]
Message-ID: <1320779837.8062.145.camel@localhost.localdomain> (raw)
From: Thomas Meyer <thomas@m3y3r.de>
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
The semantic patch that makes this change is available
in scripts/coccinelle/api/alloc/kzalloc-simple.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c 2011-11-07 19:38:11.773647045 +0100
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c 2011-11-08 09:40:13.429293412 +0100
@@ -60,10 +60,9 @@ static void *rtllib_tkip_init(int key_id
{
struct rtllib_tkip_data *priv;
- priv = kmalloc(sizeof(*priv), GFP_ATOMIC);
+ priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
if (priv == NULL)
goto fail;
- memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
CRYPTO_ALG_ASYNC);
next reply other threads:[~2011-11-08 19:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 19:17 Thomas Meyer [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-11-08 19:20 Thomas Meyer
2011-11-08 19:19 Thomas Meyer
2011-11-08 19:18 Thomas Meyer
2011-11-08 19:29 ` Jesper Juhl
2011-11-08 19:17 Thomas Meyer
2011-11-08 19:05 Thomas Meyer
2011-11-08 19:35 ` Dan Carpenter
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=1320779837.8062.145.camel@localhost.localdomain \
--to=thomas@m3y3r.de \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=wlanfae@realtek.com \
/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
all inboxes | Powered by JetHome®