[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190703165037.3041-1-colin.king@canonical.com>
Date: Wed, 3 Jul 2019 17:50:37 +0100
From: Colin King <colin.king@...onical.com>
To: Catherine Sullivan <csully@...gle.com>,
Sagi Shahar <sagis@...gle.com>,
Jon Olson <jonolson@...gle.com>,
"David S . Miller" <davem@...emloft.net>,
Willem de Bruijn <willemb@...gle.com>, netdev@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] gve: fix -ENOMEM null check on a page allocation
From: Colin Ian King <colin.king@...onical.com>
Currently the check to see if a page is allocated is incorrect
and is checking if the pointer page is null, not *page as
intended. Fix this.
Addresses-Coverity: ("Dereference before null check")
Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/net/ethernet/google/gve/gve_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 6a147ed4627f..6ea74c364a4b 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -516,7 +516,7 @@ int gve_alloc_page(struct device *dev, struct page **page, dma_addr_t *dma,
enum dma_data_direction dir)
{
*page = alloc_page(GFP_KERNEL);
- if (!page)
+ if (!*page)
return -ENOMEM;
*dma = dma_map_page(dev, *page, 0, PAGE_SIZE, dir);
if (dma_mapping_error(dev, *dma)) {
--
2.20.1
Powered by blists - more mailing lists