diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index b4368c5b6a0cc9df10cff1a2b6145e0a72bfdced..403ec42472d1d9ff9480e2db0b3a12ee03fc4004 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -61,7 +61,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) return -EINVAL; } - data = kzalloc(sizeof(*data) + sizeof(struct resource *) * dev_dax->nr_range, GFP_KERNEL); + data = kzalloc(struct_size(data, res, dev_dax->nr_range), GFP_KERNEL); if (!data) return -ENOMEM;