Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/tyr: missing Fixes trailer for Cursor bounds and overflow
  fix
--

commit b90a1dd0329f798d9b7953db9ea5076afe11d6da
Author: Bilal Hashim <[email protected]>

> drm/tyr: fw: fix integer overflow and inverted range check in Cursor
>
> In drivers/gpu/drm/tyr/fw/parser.rs, the firmware binary parser `Cursor`
> has two bounds-checking bugs that can panic the kernel on malformed
> firmware images:
>
> 1. `Cursor::view()` checks `range.start < self.pos || range.end >
>    self.data.len()`, but does not check `range.start > range.end`. An
>    inverted range passes the check and panics when indexing
>    `&self.data[range]`.
> 2. `Cursor::read()` and `Cursor::advance()` compute `self.pos + nbytes`
>    without overflow checking. On 32-bit systems (or with large `nbytes`),
>    the addition can wrap around to a value less than `self.data.len()`,
>    bypassing the bounds check and panicking in `&self.data[start..end]`
>    or corrupting `self.pos`.
>
> Use `checked_add()` in `read()` and `advance()`, and reject inverted
> ranges (`range.start > range.end`) in `view()`.
>
> Signed-off-by: Bilal Hashim <[email protected]>

[Severity: Low]
This fixes bounds-checking bugs in Cursor::view(), Cursor::read(), and
Cursor::advance().  Should the commit message include a Fixes tag?

  Fixes: aa9ce8201360 ("drm/tyr: add parser for firmware binary")

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to