Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: kernel test robot <lkp@intel.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Paolo Abeni <pabeni@redhat.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Simon Horman <horms@kernel.org>
Subject: Re: [linux-next:master 10570/10862] drivers/net/ethernet/airoha/airoha_eth.c:3470:18: warning: division by zero is undefined
Date: Fri, 31 Jul 2026 17:33:02 +0200	[thread overview]
Message-ID: <amzALtFffHRXcefS@lore-desk> (raw)
In-Reply-To: <CANiq72nFoPshLi_8OAYxpda-rJnRCh=UpB2CovMZXj+vo3BDeA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

> On Fri, Jul 31, 2026 at 5:03 PM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > Is it a false-positive? I can't see how sizeof((arr)[0]) can be 0 here.
> 
> `CONFIG_SMP` is not set, so the spinlock is empty, no?

ack, right. We can just use AIROHA_NUM_NETDEV_TX_RINGS instead of ARRAY_SIZE().

diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index dba7c52c0896..64619e9a704d 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -3467,7 +3467,7 @@ static int airoha_alloc_gdm_device(struct airoha_eth *eth,
 	netdev->dev.of_node = of_node_get(np);
 	dev = netdev_priv(netdev);
 	u64_stats_init(&dev->stats.syncp);
-	for (i = 0; i < ARRAY_SIZE(dev->txq_lock); i++)
+	for (i = 0; i < AIROHA_NUM_NETDEV_TX_RINGS; i++)
 		spin_lock_init(&dev->txq_lock[i]);
 	dev->port = port;
 	dev->eth = eth;

Regards,
Lorenzo

> 
> Cheers,
> Miguel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-07-31 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 10:33 [linux-next:master 10570/10862] drivers/net/ethernet/airoha/airoha_eth.c:3470:18: warning: division by zero is undefined kernel test robot
2026-07-31 14:50 ` Lorenzo Bianconi
2026-07-31 15:13   ` Miguel Ojeda
2026-07-31 15:33     ` Lorenzo Bianconi [this message]

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=amzALtFffHRXcefS@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=horms@kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=oe-kbuild-all@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