Skip to content

Commit 9b8bdd1

Browse files
JiangJiaskuba-moo
authored andcommitted
sfc: falcon: Check null pointer of rx_queue->page_ring
Because of the possible failure of the kcalloc, it should be better to set rx_queue->page_ptr_mask to 0 when it happens in order to maintain the consistency. Fixes: 5a6681e ("sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver") Signed-off-by: Jiasheng Jiang <[email protected]> Acked-by: Martin Habets <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bdf1b5c commit 9b8bdd1

File tree

1 file changed

+4
-1
lines changed
  • drivers/net/ethernet/sfc/falcon

1 file changed

+4
-1
lines changed

drivers/net/ethernet/sfc/falcon/rx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,10 @@ static void ef4_init_rx_recycle_ring(struct ef4_nic *efx,
728728
efx->rx_bufs_per_page);
729729
rx_queue->page_ring = kcalloc(page_ring_size,
730730
sizeof(*rx_queue->page_ring), GFP_KERNEL);
731-
rx_queue->page_ptr_mask = page_ring_size - 1;
731+
if (!rx_queue->page_ring)
732+
rx_queue->page_ptr_mask = 0;
733+
else
734+
rx_queue->page_ptr_mask = page_ring_size - 1;
732735
}
733736

734737
void ef4_init_rx_queue(struct ef4_rx_queue *rx_queue)

0 commit comments

Comments
 (0)