staging: lustre: lnet: klnds: o2iblnd: fix null dereference on failed path in o2iblnd.c
authorJiayi Ye <yejiayily@gmail.com>
Sat, 25 Oct 2014 03:40:32 +0000 (11:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Oct 2014 10:52:37 +0000 (18:52 +0800)
commit3247c4e5ef5d78b47bf2b223d2e684e77845431b
treef7f8921e55c84669105700613b230f739fdefd40
parent85b4260ddfed16b0069262a2a843fd59562a2ee2
staging: lustre: lnet: klnds: o2iblnd: fix null dereference on failed path in o2iblnd.c

If net is null and failed path is executed, dereference null may happen.
This patch fixes it. The following Coccinelle semantic patch was used.

@@
expression E, E1;
identifier f;
statement S1,S2,S3;
@@

* if (E == NULL)
{
  ... when != if (E == NULL) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c