]> git.baikalelectronics.ru Git - kernel.git/commit
drivers/net/ethernet/ti/davinci_cpdma.c: Remove potential NULL dereference
authorJulia Lawall <Julia.Lawall@lip6.fr>
Tue, 14 Aug 2012 05:49:47 +0000 (05:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Aug 2012 23:59:43 +0000 (16:59 -0700)
commit23682ee21a0f8e43a05d10b794ba51339aee62e3
tree5c0d7a6e98f10860dbfeffddf1bd5bd5e245b7e6
parent18a52620204331d0736e31da959a79a294ecde04
drivers/net/ethernet/ti/davinci_cpdma.c: Remove potential NULL dereference

If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_cpdma.c