Re: [PATCH net-next] net: ntb_netdev: Fix NULL check ordering in TX handler
ALOK TIWARI <[email protected]> Thu, 26 Feb 2026 19:44:51 +0530
| Newsgroups | dev.linux.lists.ntb,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 2/26/2026 8:52 AM, Jakub Kicinski wrote: > 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" Thanks Jakub, it seems these changes have now been superseded by Koichiro's patch series. > >> Move netdev_priv() after validating ndev. >> >> No functional change intended. > -- pw-bot: cr https://lore.kernel.org/all/u6k7xyjkqdn5xsgderrxi5yw6mhwtl3srfeefagp44jco7jc44@c7f4tzlaem2l/ Thanks, Alok