mirror of https://gitee.com/openkylin/linux.git
rocker: add a check for NULL in rocker_probe_ports()
Make sure kmalloc() succeeds. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Scott Feldman <sfeldma@gmail.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f01aa633e0
commit
e65ad3be86
|
@ -4201,6 +4201,8 @@ static int rocker_probe_ports(struct rocker *rocker)
|
|||
|
||||
alloc_size = sizeof(struct rocker_port *) * rocker->port_count;
|
||||
rocker->ports = kmalloc(alloc_size, GFP_KERNEL);
|
||||
if (!rocker->ports)
|
||||
return -ENOMEM;
|
||||
for (i = 0; i < rocker->port_count; i++) {
|
||||
err = rocker_probe_port(rocker, i);
|
||||
if (err)
|
||||
|
|
Loading…
Reference in New Issue