mtd: spear_smi: add NULL check on devm_kzalloc() return value
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 6 Jul 2017 22:25:50 +0000 (17:25 -0500)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 15 Aug 2017 12:00:42 +0000 (14:00 +0200)
commit90cc62f3431b558ea10b0248e3ba85f656bf61f5
tree8dbb86acf08710f0a4d609ccb857b2e0d6f0ce70
parent1fbef470f3691a4a8afc4937c4ad1901e42901c4
mtd: spear_smi: add NULL check on devm_kzalloc() return value

Check return value from call to devm_kzalloc()
in order to prevent a NULL pointer dereference.

This issue was detected using Coccinelle and the following semantic patch:

@@
expression x;
identifier fld;
@@

* x = devm_kzalloc(...);
  ... when != x == NULL
  x->fld

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/devices/spear_smi.c