Merge branches 'stable/balloon.cleanup' and 'stable/general.cleanup' of git://git...
[pandora-kernel.git] / drivers / net / wireless / wl12xx / testmode.c
index e64403b..6ec06a4 100644 (file)
@@ -204,7 +204,10 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
 
        kfree(wl->nvs);
 
-       wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
+       if (len != sizeof(struct wl1271_nvs_file))
+               return -EINVAL;
+
+       wl->nvs = kzalloc(len, GFP_KERNEL);
        if (!wl->nvs) {
                wl1271_error("could not allocate memory for the nvs file");
                ret = -ENOMEM;