Thread (3 messages) 3 messages, 3 authors, 2026-02-28

Re: [PATCH net v3] net: core: failover: fix NULL pointer dereference in failover_slave_register()

From: Dan Carpenter <hidden>
Date: 2026-02-26 09:22:49
Also in: kernel-janitors, lkml

On Thu, Feb 26, 2026 at 01:56:01PM +0500, Zeeshan Ahmad wrote:
Smatch warns that 'fops' is dereferenced without a NULL check.
While other callbacks in this function properly check 'fops', the
rx_handler registration does not.

Consolidate the NULL check for 'fops' at the beginning of the function,
before it is first used in slave_pre_register(). This ensures 'fops' is
valid for the entire function scope and allows the removal of redundant
NULL checks later in the function, as suggested by Dan Carpenter.

Fixes: 30c8bd5aa8b2 ("net: Introduce generic failover module")
Signed-off-by: Zeeshan Ahmad <redacted>
---
v3:
 - Move the fops NULL check to the top of the function before any 
   dereferences occur and remove subsequent redundant NULL checks, 
   as suggested by Dan Carpenter.
Thanks!

Reviewed-by: Dan Carpenter <redacted>

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help