Quentin LAMBERT

Author's posts

[MTD] drivers/mtd/maps/nettel.c: use ARRAY_SIZE

Author: Julia Lawall <julia@diku.dk> ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its type or the size of its first element. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @i@ @@ #include @depends on i using “paren.iso”@ type T; T[] E; …

Continue reading

[ARM] eliminate NULL test and memset after alloc_bootmem

Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; statement S; …

Continue reading

[MTD] [NAND] drivers/mtd/nand/pasemi_nand.c: Add missing pci_dev_put

Author: Julia Lawall <julia@diku.dk> pci_get_device increments a reference count that should be decremented using pci_dev_put. The semantic patch that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S,S1; position p1,p2,p3; expression E,E1; type T,T1; expression *ptr != NULL; @@ ( if ((x@p1 = pci_get_device(…)) == NULL) S | x@p1 …

Continue reading

drivers/isdn/mISDN: use ARRAY_SIZE

Author: Julia Lawall <julia@diku.dk> ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its type or the size of its first element. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @i@ @@ #include @depends on i using “paren.iso”@ type T; T[] E; …

Continue reading

Bluetooth: Change simple_strtol to simple_strtoul

Author: Julia Lawall <julia@diku.dk> Since size, addr, fcs, and tmp are unsigned, it would seem better to use simple_strtoul that simple_strtol. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r2@ long e; position p; @@ e = simple_strtol@p(…) @@ position p != r2.p; type T; T e; …

Continue reading

ALSA: sound/pci/mixart/mixart.c: Add missing snd_card_free

Author: Julia Lawall <julia@diku.dk> The function snd_mixart_create creates a link between mgr and card that allows snd_mixart_free to free card as well. But if snd_mixart_create fails, then the link has not been created and card has to be freed explicitly. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local …

Continue reading

USB: gadget: change simple_strtol to simple_strtoul

Author: Julia Lawall <julia@diku.dk> Since num is unsigned, it would seem better to use simple_strtoul that simple_strtol. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r2@ long e; position p; @@ e = simple_strtol@p(…) @@ position p != r2.p; type T; T e; @@ e = – …

Continue reading

arch/x86/kernel/pci-calgary_64.c: change simple_strtol to simple_strtoul

Author: Julia Lawall <julia@diku.dk> Impact: fix theoretical option string parsing overflow Since bridge is unsigned, it would seem better to use simple_strtoul that simple_strtol. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r2@ long e; position p; @@ e = simple_strtol@p(…) @@ position p != r2.p; type …

Continue reading

MIPS: Alchemy: Change strict_strtol to strict_strtoul

Author: Julia Lawall <julia@diku.dk> Since memsize is unsigned, it would seem better to use strict_strtoul that strict_strtol. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @s2@ long e; position p; @@ strict_strtol@p(…,&e) @@ position p != s2.p; type T; T e; @@ – strict_strtol@p + strict_strtoul (…,&e) …

Continue reading

arch/avr32: Eliminate NULL test and memset after alloc_bootmem

Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; statement S; …

Continue reading