]> git.proxmox.com Git - mirror_ubuntu-disco-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)
commitf37c54b6a6c56489221d42ff27305e4f8098e34b
tree5c0d7a6e98f10860dbfeffddf1bd5bd5e245b7e6
parentaadf31de16a7b2878af00a02e6557df84efa784b
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