]> 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)
commitd712fecc1dd592455a2b36c5ec82df3c7d31c6a0
tree5c0d7a6e98f10860dbfeffddf1bd5bd5e245b7e6
parent09052494cd0c3ccc26ede3f4856437b40da4dc74
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