8139too: make PCI device ids constant

Author: Márton Németh <nm127@freemail.hu> The id_table field of the struct pci_driver is constant in so it is worth to make pci_device_id also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier I1, I2, x; @@ struct I1 { … const struct I2 *x; … }; @s@ identifier …

Lire la suite

USB: FHCI: Correct the size argument to kzalloc

Author: Julia Lawall <julia@diku.dk> urb_priv->tds has type struct td **, not struct td *, so the elements of the array should have pointer type, not structure type. Convert kzalloc to kcalloc as well. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @disable sizeof_type_expr@ type T; T **x; @@ x = // …

Lire la suite

mtd: physmap_of: Correct the size argument to kzalloc

Author: Julia Lawall <julia@diku.dk> mtd_list has type struct mtd_info **, not struct mtd_info *, so the elements of the array should have pointer type, not structure type. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @disable sizeof_type_expr@ type T; T **x; @@ x = // Signed-off-by: Julia Lawall Signed-off-by: David Woodhouse …

Lire la suite

drivers/net : Correct the size argument to kzalloc

Author: Julia Lawall <julia@diku.dk> lp->rx_skb has type struct sk_buff **, not struct sk_buff *, so the elements of the array should have pointer type, not structure type. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @disable sizeof_type_expr@ type T; T **x; @@ x = // Signed-off-by: Julia Lawall Signed-off-by: David S. …

Lire la suite

V4L/DVB (13954): 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/) // @r@ identifier f; @@ f(…) { } @@ expression *x; expression y; identifier r.f; statement S; @@ x = f(…); ( if ((x) == NULL) S | if …

Lire la suite

drivers/block/drbd: 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/net/can: 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

ext4: Eliminate potential double free on error path

Author: Julia Lawall <julia@diku.dk> b_entry_name and buffer are initially NULL, are initialized within a loop to the result of calling kmalloc, and are freed at the bottom of this loop. The loop contains gotos to cleanup, which also frees b_entry_name and buffer. Some of these gotos are before the reinitializations of b_entry_name and buffer. To …

Lire la suite

V4L/DVB (13949): Move a dereference below a NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test is necessary, then the dereference should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; expression E; identifier i,fld; statement S; @@ – T i = E->fld; + T i; … when != E when …

Lire la suite

mfd: Correct use after free for t7l66xb

Author: Julia Lawall <julia@diku.dk> The structure t7l66xb should not be freed before the subsequent references to its fields in the arguments to clk_put. Furthermore, this structure is allocated near the beginning of the function, and a goto to the label err_noirq appears after a successful allocation, so it would seem that the kfree should be …

Lire la suite