diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-13 16:00:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-14 17:02:56 -0400 |
commit | 7a6cb0d5497418599d2125b670926b75e673861c (patch) | |
tree | a698dc86695304ef6aefe4bc6d18fdad7f3770ee /drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | |
parent | b5a2104c98cb603f7053e4b0309fb88f15d6be86 (diff) |
Staging: Use kcalloc or kzalloc
Use kcalloc or kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,y,flags;
statement S;
type T;
@@
x =
- kmalloc
+ kcalloc
(
- y * sizeof(T),
+ y, sizeof(T),
flags);
if (x == NULL) S
-memset(x, 0, y * sizeof(T));
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Diffstat (limited to 'drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 0b57632bcff..4b078e53638 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -68,10 +68,9 @@ static void * ieee80211_ccmp_init(int key_idx) | |||
68 | { | 68 | { |
69 | struct ieee80211_ccmp_data *priv; | 69 | struct ieee80211_ccmp_data *priv; |
70 | 70 | ||
71 | priv = kmalloc(sizeof(*priv), GFP_ATOMIC); | 71 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); |
72 | if (priv == NULL) | 72 | if (priv == NULL) |
73 | goto fail; | 73 | goto fail; |
74 | memset(priv, 0, sizeof(*priv)); | ||
75 | priv->key_idx = key_idx; | 74 | priv->key_idx = key_idx; |
76 | 75 | ||
77 | priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); | 76 | priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); |