Commit ba42fad0 authored by Ivan Vecera's avatar Ivan Vecera Committed by David S. Miller

be2net: add dma_mapping_error() check for dma_map_page()

The driver does not check value returned by dma_map_page. The patch
fixes this.

v2: Removed the bugfix for non-bug ;-) (thanks Sathya)
Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
Acked-by: default avatarSathya Perla <Sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d9aee591
...@@ -1776,6 +1776,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) ...@@ -1776,6 +1776,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp)
struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL; struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL;
struct be_queue_info *rxq = &rxo->q; struct be_queue_info *rxq = &rxo->q;
struct page *pagep = NULL; struct page *pagep = NULL;
struct device *dev = &adapter->pdev->dev;
struct be_eth_rx_d *rxd; struct be_eth_rx_d *rxd;
u64 page_dmaaddr = 0, frag_dmaaddr; u64 page_dmaaddr = 0, frag_dmaaddr;
u32 posted, page_offset = 0; u32 posted, page_offset = 0;
...@@ -1788,9 +1789,15 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) ...@@ -1788,9 +1789,15 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp)
rx_stats(rxo)->rx_post_fail++; rx_stats(rxo)->rx_post_fail++;
break; break;
} }
page_dmaaddr = dma_map_page(&adapter->pdev->dev, pagep, page_dmaaddr = dma_map_page(dev, pagep, 0,
0, adapter->big_page_size, adapter->big_page_size,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
if (dma_mapping_error(dev, page_dmaaddr)) {
put_page(pagep);
pagep = NULL;
rx_stats(rxo)->rx_post_fail++;
break;
}
page_info->page_offset = 0; page_info->page_offset = 0;
} else { } else {
get_page(pagep); get_page(pagep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment