diff options
| author | Bryam Vargas <hexlabsecurity@proton.me> | 2026-06-24 01:03:46 -0500 |
|---|---|---|
| committer | Alison Schofield <alison.schofield@intel.com> | 2026-07-14 16:23:18 -0700 |
| commit | 18f9124248ed7a9da1c31973b629dceef76a9b0c (patch) | |
| tree | 7c333b77ad8fe43bac92fcf63f5d6cf5ddacc1e7 /tools/perf/scripts/python | |
| parent | 037770686126155eafc44501312989e2837b9659 (diff) | |
libnvdimm/labels: Bound the on-media label size before the shift
For a v1.2+ index, __nd_label_validate() computes the label size as
1 << (7 + nsindex[i]->labelsize), where labelsize is a u8 read from
the label storage medium. A value of 25 or more makes the shift count
reach or exceed the width of int -- undefined behavior -- and 24 already
shifts into the sign bit. Only 0 (128-byte) and 1 (256-byte) are valid.
Reject a labelsize above 1 before the shift. The result was rejected by
the following size comparison anyway, so this only removes the undefined
shift on a crafted or corrupted medium; conforming labels are unaffected.
Fixes: 564e871aa66f ("libnvdimm, label: add v1.2 nvdimm label definitions")
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20260624-b4-disp-d8279485-v3-2-cdb6cab28b41@proton.me
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
