Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Alok Tiwari <alok.a.tiwari@oracle.com>
Cc: <alok.a.tiwarilinux@gmail.com>, <michal.kubiak@intel.com>,
	<przemyslaw.kitszel@intel.com>, <anthony.l.nguyen@intel.com>,
	<andrew+netdev@lunn.ch>, <kuba@kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>, <horms@kernel.org>,
	<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH net] idpf: Fix incorrect NULL check in completion descriptor release
Date: Mon, 17 Nov 2025 11:30:10 +0100	[thread overview]
Message-ID: <8347f99e-8f00-43c0-b492-4b0b6653bbe5@intel.com> (raw)
In-Reply-To: <20251117102244.9188-1-alok.a.tiwari@oracle.com>

From: Alok Tiwari <alok.a.tiwari@oracle.com>
Date: Mon, 17 Nov 2025 02:22:25 -0800

> idpf_compl_queue uses a union for comp, comp_4b, and desc_ring.
> The release path should check complq->desc_ring to determine whether the
> DMA descriptor ring was allocated. The existing check against
> complq->comp is incorrect, as only desc_ring reliably reflects the
> allocation status.

How can it be "incorrect" if these 3 are in the same union and have the
same size of 1 pointer? Any of them reflects the allocation status.

While your change improves readability, it doesn't fixes anything at
all. You can compare the object code to see there's no difference
before/after.

C unions are not the same as C++ unions, but even if the kernel had
`-fstrict-aliasing` enabled (and it's always disabled), the result would
be same. And C unions definitely don't work like std::variant.

So this could only go to -next as a cosmetic change if you really want this.

> 
> Fixes: cfe5efec9177 ("idpf: add 4-byte completion descriptor definition")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 828f7c444d30..1e7ae6f969ac 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -134,7 +134,7 @@ static void idpf_compl_desc_rel(struct idpf_compl_queue *complq)
>  {
>  	idpf_xsk_clear_queue(complq, VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION);
>  
> -	if (!complq->comp)
> +	if (!complq->desc_ring)
>  		return;
>  
>  	dma_free_coherent(complq->netdev->dev.parent, complq->size,

Thanks,
Olek

  reply	other threads:[~2025-11-17 10:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 10:22 [Intel-wired-lan] [PATCH net] idpf: Fix incorrect NULL check in completion descriptor release Alok Tiwari
2025-11-17 10:30 ` Alexander Lobakin [this message]
2025-11-17 10:48   ` [Intel-wired-lan] [External] : " 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=8347f99e-8f00-43c0-b492-4b0b6653bbe5@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=alok.a.tiwari@oracle.com \
    --cc=alok.a.tiwarilinux@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.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