Skip to content

Commit 776dac5

Browse files
KunWuChankuba-moo
authored andcommitted
net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Fixes: 05bd97f ("net: dsa: Add Vitesse VSC73xx DSA router driver") Signed-off-by: Kunwu Chan <[email protected]> Suggested-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 03fb856 commit 776dac5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/dsa/vitesse-vsc73xx-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,8 @@ static int vsc73xx_gpio_probe(struct vsc73xx *vsc)
11351135

11361136
vsc->gc.label = devm_kasprintf(vsc->dev, GFP_KERNEL, "VSC%04x",
11371137
vsc->chipid);
1138+
if (!vsc->gc.label)
1139+
return -ENOMEM;
11381140
vsc->gc.ngpio = 4;
11391141
vsc->gc.owner = THIS_MODULE;
11401142
vsc->gc.parent = vsc->dev;

0 commit comments

Comments
 (0)