diff options
author | Colin Ian King <colin.king@canonical.com> | 2019-07-03 17:50:37 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-03 13:53:07 -0700 |
commit | a51df9f8da43e8bf9e508143630849b7d696e053 (patch) | |
tree | eff4e9de9ad6cdf31c4162c70a09741561d069e4 | |
parent | e227701c4583f0408cac33eca0fa96ac4b8ff7d9 (diff) |
gve: fix -ENOMEM null check on a page allocation
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@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/google/gve/gve_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 83f65a5a9a3f..eef500bd2ff7 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -518,7 +518,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)) { |