hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/md/dm-switch.c
....@@ -53,7 +53,7 @@
5353 /*
5454 * Array of dm devices to switch between.
5555 */
56
- struct switch_path path_list[0];
56
+ struct switch_path path_list[];
5757 };
5858
5959 static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned nr_paths,
....@@ -61,8 +61,7 @@
6161 {
6262 struct switch_ctx *sctx;
6363
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);
6665 if (!sctx)
6766 return NULL;
6867