HiDan,
On Fri, Sep 30, 2016 at 09:04:30PM +0300, Dan Carpenter wrote:
On Fri, Sep 30, 2016 at 06:24:06PM +0100, Rui Miguel Silva wrote:
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: Rui Miguel Silva <rmf...@gmail.com>
---
 drivers/staging/greybus/light.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index b2847fe..c610d55 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -290,7 +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),
+       channel->attrs = kcalloc(size + 1, sizeof(struct attribute *),

sizeof(*channel->attrs) would also work, no?

Yeah, I had that first, but thought this way would be more explicit.
Looking again to it, the channel one is more correct, will send
v2 with the change.

Cheers,
 Rui
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to