treewide: Use struct_size() for devm_kmalloc() and friends
[linux-2.6-block.git] / drivers / misc / cb710 / core.c
index fb397e7d1cce8a17ab2583c2bedc49438d72b03b..4d4acf763b655c72353ce4e9d2bbff9d962dd957 100644 (file)
@@ -232,8 +232,8 @@ static int cb710_probe(struct pci_dev *pdev,
        if (val & CB710_SLOT_SM)
                ++n;
 
-       chip = devm_kzalloc(&pdev->dev,
-               sizeof(*chip) + n * sizeof(*chip->slot), GFP_KERNEL);
+       chip = devm_kzalloc(&pdev->dev, struct_size(chip, slot, n),
+                           GFP_KERNEL);
        if (!chip)
                return -ENOMEM;