[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250805181446.3deaceb9@kernel.org>
Date: Tue, 5 Aug 2025 18:14:46 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jijie Shao <shaojijie@...wei.com>
Cc: <davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<andrew+netdev@...n.ch>, <horms@...nel.org>, <shenjian15@...wei.com>,
<liuyonglong@...wei.com>, <chenhao418@...wei.com>,
<jonathan.cameron@...wei.com>, <shameerali.kolothum.thodi@...wei.com>,
<salil.mehta@...wei.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2 net 2/3] net: hibmcge: fix the division by zero issue
On Sat, 2 Aug 2025 20:32:25 +0800 Jijie Shao wrote:
> static inline u32 hbg_get_queue_used_num(struct hbg_ring *ring)
> {
> + if (!ring->len)
> + return 0;
> +
> return (ring->ntu + ring->len - ring->ntc) % ring->len;
This should probably be a READ_ONCE() to a temporary variable.
There is no locking in debugfs, AFAICT, the value may change
between the test and the division / modulo.
--
pw-bot: cr
Powered by blists - more mailing lists