Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. Similarly for usb-alloc urb. The semantic match that finds the first problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if …
Catégorie : Linux
Dec 13 2009
ASoC: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(codec->reg_cache) is just the size of the pointer. Elsewhere in the file, codec->reg_cache is used with sizeof(wm8900_reg_defaults), so the code is changed to do the same here. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ …
Dec 13 2009
ALSA: sound/isa/gus: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(share_id) is just the size of the pointer. On the other hand, block->share_id is an array, so its size seems more appropriate. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Signed-off-by: Julia Lawall …
Dec 13 2009
V4L/DVB (13685): Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(print_buf) is just the size of the pointer. Change it to the size used in the allocation of print_buf earlier in the same function. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Cc: …
Dec 13 2009
MIPS: Alchemy: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(dp) is just the size of the pointer. Change it to the size of the referenced structure. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Signed-off-by: Julia Lawall Patchwork: http://patchwork.linux-mips.org/patch/789/ Signed-off-by: Ralf Baechle …
Dec 13 2009
drivers/net/usb: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(dev->dev_addr) is the size of a pointer. A few lines above, the size of this field is obtained using netdev->addr_len for a call to memcpy, so do the same here. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; …
Dec 13 2009
drivers/net/cpmac.c: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(dev->dev_addr) is the size of a pointer. On the other hand, sizeof(pdata->dev_addr) is the size of an array, so use that instead. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Signed-off-by: Julia Lawall …
Dec 13 2009
drivers/net/sfc: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> The function efx_iterate_state contains the code memcpy(&payload->msg, payload_msg, sizeof(payload_msg)); This is the only use of payload_msg. The type of payload_msg is changed from a pointer to an array, so that the result of sizeof really is the length of the string. A simplified version of the semantic patch that finds this …
Dec 13 2009
drivers/atm: Correct code taking the size of a pointer
Author: Julia Lawall <julia@diku.dk> sizeof(TstSchedTbl) is just the size of the pointer. Change it to the size of the referenced data. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller — …
Dec 10 2009
V4L/DVB (13611): radio-tea5764: Correct size given to memset
Author: Julia Lawall <julia@diku.dk> Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // Signed-off-by: Julia Lawall Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro …