public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Alok Tiwari <alok.a.tiwari@oracle.com>
Cc: pabeni@redhat.com, edumazet@google.com, davem@davemloft.net,
	andrew+netdev@lunn.ch, jdmason@kudzu.us, dave.jiang@intel.com,
	allenbh@gmail.com, ntb@lists.linux.dev, netdev@vger.kernel.org,
	alok.a.tiwarilinux@gmail.com
Subject: Re: [PATCH net-next] net: ntb_netdev: Fix NULL check ordering in TX handler
Date: Wed, 25 Feb 2026 19:22:11 -0800	[thread overview]
Message-ID: <20260225192211.7a8e1be8@kernel.org> (raw)
In-Reply-To: <20260224130458.1355686-1-alok.a.tiwari@oracle.com>

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

  parent reply	other threads:[~2026-02-26  3:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24 13:04 [PATCH net-next] net: ntb_netdev: Fix NULL check ordering in TX handler Alok Tiwari
2026-02-24 14:42 ` Dave Jiang
2026-02-26  3:22 ` Jakub Kicinski [this message]
2026-02-26 14:14   ` ALOK TIWARI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260225192211.7a8e1be8@kernel.org \
    --to=kuba@kernel.org \
    --cc=allenbh@gmail.com \
    --cc=alok.a.tiwari@oracle.com \
    --cc=alok.a.tiwarilinux@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dave.jiang@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jdmason@kudzu.us \
    --cc=netdev@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox