[SCSI] bnx2fc: Remove potential NULL dereference
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 22 Dec 2012 03:40:28 +0000 (19:40 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 29 Jan 2013 04:06:19 +0000 (15:06 +1100)
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: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

No differences found