* [PATCH][next] gve: fix -ENOMEM null check on a page allocation
@ 2019-07-03 16:50 Colin King
2019-07-03 20:53 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-07-03 16:50 UTC (permalink / raw)
To: Catherine Sullivan, Sagi Shahar, Jon Olson, David S . Miller,
Willem de Bruijn, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.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@canonical.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] gve: fix -ENOMEM null check on a page allocation
2019-07-03 16:50 [PATCH][next] gve: fix -ENOMEM null check on a page allocation Colin King
@ 2019-07-03 20:53 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-07-03 20:53 UTC (permalink / raw)
To: colin.king
Cc: csully, sagis, jonolson, willemb, netdev, kernel-janitors, linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Wed, 3 Jul 2019 17:50:37 +0100
> From: Colin Ian King <colin.king@canonical.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@canonical.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-03 20:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 16:50 [PATCH][next] gve: fix -ENOMEM null check on a page allocation Colin King
2019-07-03 20:53 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).