Re: [PATCH net-next] net: ntb_netdev: Fix NULL check ordering in TX handler

From
Jakub Kicinski <kuba@kernel.org>
Date
2026-02-26 03:22:12
Reply to
Alok Tiwari, 2026-02-24
On Tue, 24 Feb 2026 05:04:47 -0800 Alok Tiwari wrote:
ntb_netdev_tx_handler() calls netdev_priv(ndev) before checking
whether ndev is NULL. Although qp_data is expected to always be
valid in normal operation,
Right. Can we delete the seemingly pointless null check instead?
Defensive programming is discouraged in the kernel..
dereferencing the pointer before the
NULL check is logically incorrect.
If you strongly prefer to keep the patch as is maybe say "valid 
but surprising" rather than "logically incorrect"
Move netdev_priv() after validating ndev.

No functional change intended.
-- 
pw-bot: cr
Thread (4 messages) 4 messages, 3 authors, last reply 2026-02-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help