Quentin LAMBERT

Author's posts

ASoC: Move dereference after NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test on jack is needed, then the derefernce should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld … when != \(x = E\|&x\) * x …

Continue reading

drivers/serial/mpc52xx_uart.c: Use UPIO_MEM rather than SERIAL_IO_MEM

Author: Julia Lawall <julia@diku.dk> As in the commit 9b4a1617772d6d5ab5eeda0cd95302fae119e359, use UPIO_MEM rather than SERIAL_IO_MEM. Both have the same value. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @has_sc@ @@ #include @depends on has_sc@ @@ – SERIAL_IO_MEM + UPIO_MEM // Signed-off-by: Julia Lawall Signed-off-by: Grant Likely — drivers/serial/mpc52xx_uart.c | 2 +- 1 …

Continue reading

omap: iovmm: Add missing mutex_unlock

Author: Daniel Walker <dwalker@fifo99.com> I was using Coccinelle with the mutex_unlock semantic patch, and it unconvered this problem. It appears to be a valid missing unlock issue. This change should correct it by moving the unlock below the label. This patch is against the mainline kernel. Cc: Julia Lawall Cc: Hiroshi DOYU Signed-off-by: Daniel Walker …

Continue reading

Btrfs: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. The semantic match that finds the 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 (x == NULL) S f1 …

Continue reading

RDMA/nes: Remove duplicate .ndo_set_mac_address field initialization

Author: Julia Lawall <julia@diku.dk> The definition of nes_netdev_ops has initializations of a local function and eth_mac_addr for its ndo_set_mac_address field. This change uses only the local function. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier I, s, fld; position p0,p; expression E; @@ struct I s =@p0 { … …

Continue reading

drivers/vlynq/vlynq.c: fix resource size off by 1 error

Author: Julia Lawall <julia@diku.dk> In this case, the calls to request_mem_region, ioremap, and release_mem_region all have a consistent length argument, len, but since in other files (res->end – res->start) + 1, equivalent to resource_size(res), is used for a resource-typed structure res, one could consider whether the same should be done here. The problem was found …

Continue reading

fs/romfs: correct error-handling code

Author: Julia Lawall <julia@diku.dk> romfs_iget returns an ERR_PTR value in an error case instead of NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @match exists@ expression x, E; statement S1, S2; @@ x = romfs_iget(…) … when != x = E ( * if (x == …

Continue reading

edac: fix resource size calculation

Author: Julia Lawall <julia@diku.dk> Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct resource *res; @@ – (res->end – res->start) + 1 + resource_size(res) // Signed-off-by: Julia Lawall Signed-off-by: Doug Thompson Signed-off-by: Andrew …

Continue reading

drivers/video: add kmalloc NULL tests

Author: Julia Lawall <julia@diku.dk> Check that the result of kmalloc is not NULL before passing it to other functions. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression *x; identifier f; constant char *C; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(…); … when != x == NULL when != x != NULL when …

Continue reading

drivers/rtc: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. The semantic match that finds the 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 (x == NULL) S f1 …

Continue reading