]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/md/dm-switch.c
Merge tag 'nfs-for-5.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[linux.git] / drivers / md / dm-switch.c
index fae35caf367208ab22cbe6900010ee353f52d666..8a0f057b81220288afd70404ab83d8a5c10cefcf 100644 (file)
@@ -61,8 +61,7 @@ static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned nr_pat
 {
        struct switch_ctx *sctx;
 
-       sctx = kzalloc(sizeof(struct switch_ctx) + nr_paths * sizeof(struct switch_path),
-                      GFP_KERNEL);
+       sctx = kzalloc(struct_size(sctx, path_list, nr_paths), GFP_KERNEL);
        if (!sctx)
                return NULL;