Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bc4b46a authored by Fabian Frederick's avatar Fabian Frederick Committed by David S. Miller
Browse files

net: dsa: replace count*size kmalloc by kmalloc_array



kmalloc_array manages count*sizeof overflow.

Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f35423c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -526,7 +526,8 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,

	/* First time routing table allocation */
	if (!cd->rtable) {
		cd->rtable = kmalloc(pd->nr_chips * sizeof(s8), GFP_KERNEL);
		cd->rtable = kmalloc_array(pd->nr_chips, sizeof(s8),
					   GFP_KERNEL);
		if (!cd->rtable)
			return -ENOMEM;