On Sat, Feb 15, 2025 at 11:58:15AM +0100, Andreas Hindborg wrote: > When cloning a bio, the `bio.bi_vcnt` field is not cloned. This is a > problem if users want to perform bounds checks on the `bio.bi_io_vec` > field. Right now bi_vcnt is supposed to be an implementation detail for bio_add_*, which obviously can't be called on cloned bio. Except for the usual abuse in bcache/bcachefs that has mostly kept up except for a few read-only checks in the completion routines which also can't be called on cloned bios. It would be nice to use it as a __counted_by bound for bi_io_vec, but until that is supported on pointers in addition to the flexible arrays we can't actually do that. So as-is I don't really see a point in just assigning the value if we don't actually use it.