mtd: zero out mtd_partition struct before using it
authorBrian Norris <computersforpeace@gmail.com>
Thu, 12 Nov 2015 00:47:52 +0000 (16:47 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 12 Nov 2015 18:10:01 +0000 (10:10 -0800)
It's easier to guarantee we've cleared out all unused fields with
memset() than by manually initializing each field.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/mtdpart.c

index f8ba153f63bfebc5750a6d31b109dbc9d574cef8..46dfbf5629c31ad9f1e948f7e38d454b62c0d3c7 100644 (file)
@@ -596,11 +596,10 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
        if (length <= 0)
                return -EINVAL;
 
+       memset(&part, 0, sizeof(part));
        part.name = name;
        part.size = length;
        part.offset = offset;
-       part.mask_flags = 0;
-       part.ecclayout = NULL;
 
        new = allocate_partition(master, &part, -1, offset);
        if (IS_ERR(new))