Skip to content

Commit a51df9f

Browse files
Colin Ian Kingdavem330
authored andcommitted
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: f5cedc8 ("gve: Add transmit and receive support") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e227701 commit a51df9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/google/gve/gve_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ int gve_alloc_page(struct device *dev, struct page **page, dma_addr_t *dma,
518518
enum dma_data_direction dir)
519519
{
520520
*page = alloc_page(GFP_KERNEL);
521-
if (!page)
521+
if (!*page)
522522
return -ENOMEM;
523523
*dma = dma_map_page(dev, *page, 0, PAGE_SIZE, dir);
524524
if (dma_mapping_error(dev, *dma)) {

0 commit comments

Comments
 (0)