OSDN Git Service

platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 6 Jul 2017 22:19:02 +0000 (17:19 -0500)
committerDarren Hart (VMware) <dvhart@infradead.org>
Fri, 7 Jul 2017 16:58:31 +0000 (09:58 -0700)
commitb77a5372076984d33731a8da0fd52fc718f62a23
treefb4f3a628f49af466e8c64cec66a288c8bee9bf6
parent4edfc5406ac9d3b59f770dd7436fdcfd5d593216
platform/x86: fujitsu-laptop: 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>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/fujitsu-laptop.c