diff options
| author | Samuel Moelius <sam.moelius@trailofbits.com> | 2026-07-15 00:18:00 +0000 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2026-07-15 15:48:11 +0200 |
| commit | 00211ede62facec2915a7e6cfc17f8ce987a0078 (patch) | |
| tree | 1add0ed81bf61ba5c4fa837e5695c3606997fd23 /tools/perf/scripts/python/parallel-perf.py | |
| parent | 34dcadff8b70c409724506fbb42c366e3da2f5c8 (diff) | |
dm cache: parse invalidate_cblocks with kstrtouint()
invalidate_cblocks parses cache block numbers with sscanf() and then
stores them in the narrower dm_cblock_t type. Values larger than the
cblock representation are truncated before invalidation, so a request
for one cache block can invalidate a different block.
Checking the parsed value after sscanf() is not sufficient because
sscanf() does not reliably reject values beyond U64_MAX before storing
into the destination. Such inputs can still be converted to a wrapped
u64 value and then pass a later range check.
Split ranges in place and parse each single value or range endpoint
directly with kstrtouint() instead. This rejects malformed values and
values that do not fit in dm_cblock_t before they can be converted to
cblock values. The existing range validation continues to reject empty
or out-of-cache ranges, including the single-value U32_MAX case whose
exclusive end wraps to zero.
Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Ming-Hung Tsai <mtsai@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions
