kernel/drivers/md/dm-switch.c
.. .. @@ -53,7 +53,7 @@ 53 53 /* 54 54 * Array of dm devices to switch between. 55 55 */ 56 - struct switch_path path_list[0];56 + struct switch_path path_list[];57 57 }; 58 58 59 59 static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned nr_paths, .. .. @@ -61,8 +61,7 @@ 61 61 { 62 62 struct switch_ctx *sctx; 63 63 64 - sctx = kzalloc(sizeof(struct switch_ctx) + nr_paths * sizeof(struct switch_path),65 - GFP_KERNEL);64 + sctx = kzalloc(struct_size(sctx, path_list, nr_paths), GFP_KERNEL);66 65 if (!sctx) 67 66 return NULL; 68 67