Re: [patch 1/2] rocker: add a check for NULL in rocker_probe_ports()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 25, 2015 at 5:35 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> Make sure kmalloc() succeeds.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
> index 34389b6a..713a13c 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)

Acked-by: Scott Feldman <sfeldma@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux