[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE4R7bCVs-mnZi3gmde9ULu=XKv02Xye-X4QGYgnfYi3HO7HjA@mail.gmail.com>
Date: Wed, 25 Feb 2015 05:46:53 -0800
From: Scott Feldman <sfeldma@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Jiri Pirko <jiri@...nulli.us>, Netdev <netdev@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [patch 1/2] rocker: add a check for NULL in rocker_probe_ports()
On Wed, Feb 25, 2015 at 5:35 AM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> Make sure kmalloc() succeeds.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> 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@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists