treewide: Use struct_size() for devm_kmalloc() and friends
[linux-block.git] / drivers / dma / nbpfaxi.c
index 50559338239b6ec586e1366314bac315c7cf3269..2f9974ddfbb2fde6f20d49689502156936452eb5 100644 (file)
@@ -1305,8 +1305,8 @@ static int nbpf_probe(struct platform_device *pdev)
        cfg = of_device_get_match_data(dev);
        num_channels = cfg->num_channels;
 
-       nbpf = devm_kzalloc(dev, sizeof(*nbpf) + num_channels *
-                           sizeof(nbpf->chan[0]), GFP_KERNEL);
+       nbpf = devm_kzalloc(dev, struct_size(nbpf, chan, num_channels),
+                           GFP_KERNEL);
        if (!nbpf)
                return -ENOMEM;