Re: [PATCH] xfs: check split_sectors validity before bio_split call
From: Hongling Zeng
Date: Wed Jul 29 2026 - 03:45:26 EST
在 2026年07月29日 14:52, Christoph Hellwig 写道:
On Wed, Jul 29, 2026 at 02:31:17PM +0800, Hongling Zeng wrote:Thanks for the review. Updated v2 below - removed Fixes/stable
Fix by changing the check from !split_sectors to split_sectors <= 0Nothing can actually hit that. It only happens for invalid flags,
immediately after bio_split_rw_at() and before any arithmetic operations.
This prevents both the negative error code propagation and the undefined
behavior from left-shifting negative values.
When NULL is returned, the caller's while loop naturally terminates,
which is the correct behavior for "cannot split" cases.
Fixes: 080d01c41d44f ("xfs: implement zoned garbage collection")
Cc: <stable@xxxxxxxxxxxxxxx>
or unaligned I/O, none of which can happen for GC I/O.
I think checking all cases of the return value is fine, but the fixes
is a bit bogus, and it really is not stable material.
tags and reworded as code improvement.