Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] `IdPool::alloc_area` panics under `CONFIG_RUST_BITMAP_HARDENED` when `offset >= capacity()` instead of returning `None` to trigger dynamic growth --
--- Patch [4]: [PATCH v6 4/7] rust: id_pool: add contiguous area allocation --- commit 8aa0c8588b18c055db8bdd7090bd5d9190acf589 Author: Eliot Courtney <[email protected]> rust: id_pool: add contiguous area allocation Add IdPool::alloc_area which allocates a contiguous area with the given offset, count, and alignment. > diff --git a/rust/kernel/id_pool.rs b/rust/kernel/id_pool.rs > index 384753fe0e44a..a4a2ff417fe81 100644 > --- a/rust/kernel/id_pool.rs > +++ b/rust/kernel/id_pool.rs [ ... ] > @@ -240,6 +246,32 @@ pub fn find_unused_id(&mut self, offset: usize) -> > Option<UnusedId<'_>> { > pub fn release_id(&mut self, id: usize) { > self.map.clear_bit(id); > } > + > + /// Allocates a contiguous area of `count` IDs at or after `offset`. > + /// > + /// The start of the returned area is a multiple of `align`. > + /// > + /// Returns the allocated range upon success, or [`None`] if no such > area could be found. > + #[inline] > + #[must_use] > + pub fn alloc_area( > + &mut self, > + offset: usize, > + count: NonZero<usize>, > + align: Alignment, > + ) -> Option<Range<usize>> { [Severity: High] Does this panic under CONFIG_RUST_BITMAP_HARDENED if offset is greater than or equal to the pool's capacity? When offset is passed directly to BitmapVec::next_zero_area(), the hardened build of the bitmap operations will assert that the start offset is less than the length. If a caller dynamically searches for contiguous areas and their sliding window goes beyond the current capacity, could this crash the kernel rather than safely returning None to trigger a dynamic growth request? > + let start = self.map.next_zero_area(offset, count, align)?; > + self.map.set(start, count); > + Some(start..start + count.get()) > + } -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=4
