HomeFreeBSD

zstd: [superblock] Add defensive assert and bounds check

Description

zstd: [superblock] Add defensive assert and bounds check

The bound check condition should always be met because we selected
set_basic as our encoding type. But that code is very far away, so
assert it is true so if it is ever false we can catch it, and add a
bounds check.

Port of facebook/zstd@1047097dadd5f8dfd47e25af0738eeb4bd82f6ec

Reported-by: Coverity (CID 1524446)
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Ported-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14212

Details

Provenance
Nick Terrell <terrelln@fb.com>Authored on Jun 22 2020, 5:21 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Nov 29 2022, 6:04 PM
Parents
rGeb1ed2a66b7f: Coverity Model Update
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG466cf54ecf2f: zstd: [superblock] Add defensive assert and bounds check (authored by Nick Terrell <terrelln@fb.com>).Nov 29 2022, 6:04 PM