diff options
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r-- | net/dsa/dsa2.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 410f19148106..c00ee464afc7 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c | |||
@@ -771,11 +771,10 @@ static int dsa_switch_probe(struct dsa_switch *ds) | |||
771 | 771 | ||
772 | struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n) | 772 | struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n) |
773 | { | 773 | { |
774 | size_t size = sizeof(struct dsa_switch) + n * sizeof(struct dsa_port); | ||
775 | struct dsa_switch *ds; | 774 | struct dsa_switch *ds; |
776 | int i; | 775 | int i; |
777 | 776 | ||
778 | ds = devm_kzalloc(dev, size, GFP_KERNEL); | 777 | ds = devm_kzalloc(dev, struct_size(ds, ports, n), GFP_KERNEL); |
779 | if (!ds) | 778 | if (!ds) |
780 | return NULL; | 779 | return NULL; |
781 | 780 | ||