diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-02-25 14:35:32 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-27 21:53:43 +0100 |
commit | e65ad3be869b45f90a401d8ce4d4e7381c99ceb0 (patch) | |
tree | 78ccf9b93c8575e8e15ec9265da7f6baccb63915 /drivers/net/ethernet/rocker/rocker.c | |
parent | cxgb4: Fix PCI-E Memory window interface for big-endian systems (diff) | |
download | linux-e65ad3be869b45f90a401d8ce4d4e7381c99ceb0.tar.xz linux-e65ad3be869b45f90a401d8ce4d4e7381c99ceb0.zip |
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 '')
-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) |