Catégorie : Linux

drivers/net: Use kcalloc or kzalloc

Author: Julia Lawall <julia@diku.dk> 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/) // @@ expression x,y,flags; statement S; type T; @@ x = – kmalloc + kcalloc ( – y * sizeof(T), + y, sizeof(T), flags); if (x == NULL) …

Lire la suite

drivers/net/vmxnet3: Use kzalloc

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // Signed-off-by: Julia Lawall Signed-off-by: Bhavesh Davda Signed-off-by: David …

Lire la suite

net/caif: Use kzalloc

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than the combination of kmalloc and memset. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // Signed-off-by: Julia Lawall Acked-by: …

Lire la suite

drivers/net: Use kzalloc

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // Signed-off-by: Julia Lawall Acked-by: Lennert Buytenhek Signed-off-by: David …

Lire la suite

fs/ocfs2/dlm: Drop memory allocation cast

Author: Julia Lawall <julia@diku.dk> Drop cast on the result of kmalloc and similar functions. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; @@ – (T *) (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(…)) // Signed-off-by: Julia Lawall Signed-off-by: Joel Becker — fs/ocfs2/dlm/dlmlock.c | 2 +- fs/ocfs2/dlm/dlmmaster.c | 18 ++++++———— 2 files changed, 7 …

Lire la suite

Staging: Drop memory allocation cast

Author: Julia Lawall <julia@diku.dk> Drop cast on the result of kmalloc and similar functions. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; @@ – (T *) (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(…)) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/comedi/drivers/unioxx5.c | 2 +- drivers/staging/crystalhd/crystalhd_misc.c | 2 +- drivers/staging/cx25821/cx25821-audio-upstream.c | 6 ++—- …

Lire la suite

drivers/net/wireless/hostap: Drop memory allocation cast

Author: Julia Lawall <julia@diku.dk> Drop cast on the result of kmalloc and similar functions. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; @@ – (T *) (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(…)) // Signed-off-by: Julia Lawall Signed-off-by: John W. Linville — drivers/net/wireless/hostap/hostap_80211_rx.c | 3 +– drivers/net/wireless/hostap/hostap_ioctl.c | 3 +– 2 files changed, …

Lire la suite

arch/arm/plat-pxa/dma.c: correct NULL test

Author: Julia Lawall <julia@diku.dk> Test the just-allocated value for NULL rather than some other value. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,y; statement S; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(…); ( if ((x) == NULL) S | if ( – y + x == NULL) S ) // Signed-off-by: …

Lire la suite

drivers/acpi: use kasprintf

Author: Julia Lawall <julia@diku.dk> kasprintf combines kmalloc and sprintf, and takes care of the size calculation itself. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression a,flag; expression list args; statement S; @@ a = – \(kmalloc\|kzalloc\)(…,flag) + kasprintf(flag,args) – sprintf(a,args); // [akpm@linux-foundation.org: don’t change handling of `count’] Signed-off-by: Julia …

Lire la suite

serial: drivers/serial/pmac_zilog.c: add missing unlock

Author: Julia Lawall <julia@diku.dk> In an error handling case the lock is not unlocked. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ expression E1; identifier f; @@ f (…) { } // Signed-off-by: Julia Lawall Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman — …

Lire la suite