projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c42f736
)
staging: greybus: fix a missing-check bug in gb_lights_light_config()
author
Chen Zhou
<chenzhou10@huawei.com>
Wed, 1 Apr 2020 03:00:17 +0000
(11:00 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Mon, 13 Apr 2020 06:55:26 +0000
(08:55 +0200)
In gb_lights_light_config(), 'light->name' is allocated by kstrndup().
It returns NULL when fails, add check for it.
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Link:
https://lore.kernel.org/r/20200401030017.100274-1-chenzhou10@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/light.c
patch
|
blob
|
history
diff --git
a/drivers/staging/greybus/light.c
b/drivers/staging/greybus/light.c
index d6ba25f21d807148914f3a36eb24ad44649e6e53..d2672b65c3f491cb92c5090df5ebd4c3cbf4a0ae 100644
(file)
--- a/
drivers/staging/greybus/light.c
+++ b/
drivers/staging/greybus/light.c
@@
-1026,7
+1026,8
@@
static int gb_lights_light_config(struct gb_lights *glights, u8 id)
light->channels_count = conf.channel_count;
light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL);
-
+ if (!light->name)
+ return -ENOMEM;
light->channels = kcalloc(light->channels_count,
sizeof(struct gb_channel), GFP_KERNEL);
if (!light->channels)