mirror of https://gitee.com/openkylin/linux.git
mtd: zero out mtd_partition struct before using it
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>
This commit is contained in:
parent
215a02fd30
commit
9386723389
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue