Commit 7a166854 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David S. Miller
Browse files

net: ethernet: ti: cpsw_ale: Fix access to un-initialized memory



It is spurious to allocate a bitmap without initializing it.
So, better safe than sorry, initialize it to 0 at least to have some known
values.

While at it, switch to the devm_bitmap_ API which is less verbose.

Fixes: 4b41d343 ("net: ethernet: ti: cpsw: allow untagged traffic on host port")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f64ab8e4
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1299,9 +1299,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
	if (!ale)
		return ERR_PTR(-ENOMEM);

	ale->p0_untag_vid_mask =
		devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID),
				   sizeof(unsigned long),
	ale->p0_untag_vid_mask = devm_bitmap_zalloc(params->dev, VLAN_N_VID,
						    GFP_KERNEL);
	if (!ale->p0_untag_vid_mask)
		return ERR_PTR(-ENOMEM);