Skip to content

Commit 7a16685

Browse files
tititiou36davem330
authored andcommitted
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: 4b41d34 ("net: ethernet: ti: cpsw: allow untagged traffic on host port") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f64ab8e commit 7a16685

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/ethernet/ti/cpsw_ale.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,8 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
12991299
if (!ale)
13001300
return ERR_PTR(-ENOMEM);
13011301

1302-
ale->p0_untag_vid_mask =
1303-
devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID),
1304-
sizeof(unsigned long),
1305-
GFP_KERNEL);
1302+
ale->p0_untag_vid_mask = devm_bitmap_zalloc(params->dev, VLAN_N_VID,
1303+
GFP_KERNEL);
13061304
if (!ale->p0_untag_vid_mask)
13071305
return ERR_PTR(-ENOMEM);
13081306

0 commit comments

Comments
 (0)