All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch v2] sfc: check for allocation failure
Date: Wed, 04 Sep 2013 15:07:27 +0000	[thread overview]
Message-ID: <20130904150727.GA32327@elgon.mountain> (raw)
In-Reply-To: <20130903.224939.866623192858217581.davem@davemloft.net>

It upsets static analyzers when we don't check for allocation failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: rebased on latest linux-next

diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 38d179c..75799f8 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -894,6 +894,8 @@ static int falcon_mtd_probe(struct efx_nic *efx)
 
 	/* Allocate space for maximum number of partitions */
 	parts = kcalloc(2, sizeof(*parts), GFP_KERNEL);
+	if (!parts)
+		return -ENOMEM;
 	n_parts = 0;
 
 	spi = &nic_data->spi_flash;

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch v2] sfc: check for allocation failure
Date: Wed, 4 Sep 2013 18:07:27 +0300	[thread overview]
Message-ID: <20130904150727.GA32327@elgon.mountain> (raw)
In-Reply-To: <20130903.224939.866623192858217581.davem@davemloft.net>

It upsets static analyzers when we don't check for allocation failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: rebased on latest linux-next

diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 38d179c..75799f8 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -894,6 +894,8 @@ static int falcon_mtd_probe(struct efx_nic *efx)
 
 	/* Allocate space for maximum number of partitions */
 	parts = kcalloc(2, sizeof(*parts), GFP_KERNEL);
+	if (!parts)
+		return -ENOMEM;
 	n_parts = 0;
 
 	spi = &nic_data->spi_flash;

  parent reply	other threads:[~2013-09-04 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-02  9:04 [patch] sfc: check for allocation failure Dan Carpenter
2013-09-02  9:04 ` Dan Carpenter
2013-09-02 17:00 ` Ben Hutchings
2013-09-02 17:00   ` Ben Hutchings
2013-09-04  2:49 ` David Miller
2013-09-04  2:49   ` David Miller
2013-09-04 14:41   ` Ben Hutchings
2013-09-04 14:41     ` Ben Hutchings
2013-09-04 15:07   ` Dan Carpenter [this message]
2013-09-04 15:07     ` [patch v2] " Dan Carpenter
2013-09-04 15:51     ` Ben Hutchings
2013-09-04 15:51       ` Ben Hutchings
2013-09-04 17:08     ` David Miller
2013-09-04 17:08       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130904150727.GA32327@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=bhutchings@solarflare.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.