diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-02-25 16:35:32 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-27 23:53:43 +0300 |
commit | e65ad3be869b45f90a401d8ce4d4e7381c99ceb0 (patch) | |
tree | 78ccf9b93c8575e8e15ec9265da7f6baccb63915 /drivers/net/ethernet | |
parent | f01aa633e040e52603b8defd2263691d15b86cb0 (diff) | |
download | linux-e65ad3be869b45f90a401d8ce4d4e7381c99ceb0.tar.xz |
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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/rocker/rocker.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index 34389b6aa67c..713a13cb8c14 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c @@ -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) |