Skip to content

Commit

Permalink
rocker: add a check for NULL in rocker_probe_ports()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Feb 27, 2015
1 parent f01aa63 commit e65ad3b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/rocker/rocker.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e65ad3b

Please sign in to comment.