提交 3855eeec 编写于 作者: R Rui Miguel Silva 提交者: Greg Kroah-Hartman

staging: greybus: light: fix attributes allocation

Fix allocation of attributes with the correct size, this also fix smatch
warning:

drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16
Signed-off-by: NRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 85a42dc8
......@@ -290,8 +290,7 @@ static int channel_attr_groups_set(struct gb_channel *channel,
return 0;
/* Set attributes based in the channel flags */
channel->attrs = kcalloc(size + 1, sizeof(**channel->attrs),
GFP_KERNEL);
channel->attrs = kcalloc(size + 1, sizeof(*channel->attrs), GFP_KERNEL);
if (!channel->attrs)
return -ENOMEM;
channel->attr_group = kcalloc(1, sizeof(*channel->attr_group),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册