Re: [PATCH v2 1/2] md: Fix overflow in is_mddev_idle
From: Song Liu <song@kernel.org>
Date: 2023-12-18 16:05:03
Also in:
linux-block, lkml
From: Song Liu <song@kernel.org>
Date: 2023-12-18 16:05:03
Also in:
linux-block, lkml
On Sun, Dec 17, 2023 at 5:39 PM Yu Kuai [off-list ref] wrote:
[...]
quoted
We only use this for idle or not check, the behavior is OK (I think). However, this logic is error prone. On 64-bit systems, there is a 4-byte hole behind sync_io. I think we can just use it for atomic64_t so that we don't have to worry about overflow.I'm not sure about this, because other than this ubsan warning, this overflow doesn't have any impact on functionality to me.
Fixing warnings for zero or low cost is always a good idea. It helps boost the signal when UBSAN (and other debug features) detects real issues.
If we care about this 'hole', there are lots of holes in gendisk, and can be avoiled, for example, moving 'sync_io' near to 'node_id'.
The point was not "let's fill the hole", but "we can use atomic64_t without extra memory cost". In general, I don't think we care too much about holes in "struct gendisk". Does this make sense? Thanks, Song