Subject: Re: [PATCH] octeon_ep_vf: add NULL check for napi_build_skb()

From: Simon Horman <[email-masked]>
Date: Wed, 8 Apr 2026 18:02:06 +0100

On Fri, Apr 03, 2026 at 09:07:32PM +0100, David Carlier wrote:
> napi_build_skb() can return NULL on allocation failure. In
> __octep_vf_oq_process_rx(), the result is used directly without a NULL
> check in both the single-buffer and multi-fragment paths, leading to a
> NULL pointer dereference.
> 
> Add NULL checks after both napi_build_skb() calls, properly advancing
> descriptors and consuming remaining fragments on failure.
> 
> Fixes: 1cd3b407977c ("octeon_ep_vf: add Tx/Rx processing and interrupt support")
> Cc: [email-masked]
> Signed-off-by: David Carlier <[email-masked]>

Hi David,

I appreciate that this is on the fast path, and thus I expect it
is performance critical. But this patch largely duplicates code
already present in the same function. Would it be possible
refactor things a bit - e.g. using helpers - to make the change
a bit cleaner while not hurting performance?

If so, I'd suggest splitting patch(es) that refactor the code
from the patch that fixes the bug.

...