staging: wilc1000: fix incorrect allocation size for structure
authorColin Ian King <colin.king@canonical.com>
Thu, 27 Sep 2018 12:17:49 +0000 (13:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Sep 2018 12:30:52 +0000 (14:30 +0200)
Currently the allocation for str_vals is for the sizeof the pointer
rather than the size of the structure.  Fix this.

Detected by smatch
"wilc_wlan_cfg_init() error: not allocating enough data 392 vs 8"

Fixes: acceb12a9f8b ("staging: wilc1000: refactor code to avoid static variables for config parameters")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wlan_cfg.c

index 930a389..faa001c 100644 (file)
@@ -457,7 +457,7 @@ int wilc_wlan_cfg_init(struct wilc *wl)
        if (!wl->cfg.s)
                goto out_w;
 
-       str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL);
+       str_vals = kzalloc(sizeof(*str_vals), GFP_KERNEL);
        if (!str_vals)
                goto out_s;