All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] sfc: check for allocation failure
@ 2013-09-02  9:04 ` Dan Carpenter
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2013-09-02  9:04 UTC (permalink / raw)
  To: Solarflare linux maintainers; +Cc: Ben Hutchings, netdev, kernel-janitors

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/sfc/mtd.c b/drivers/net/ethernet/sfc/mtd.c
index ba6c87a..aac6897 100644
--- a/drivers/net/ethernet/sfc/mtd.c
+++ b/drivers/net/ethernet/sfc/mtd.c
@@ -384,6 +384,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;

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-09-05 13:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [patch v2] " Dan Carpenter
2013-09-04 15:07     ` 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

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.