HomeFreeBSD

kboot: Avoid UB in signed shift

Description

kboot: Avoid UB in signed shift

offset is signed. Copy it to the unsigned res before shifting. This
avoids any possible undefined behavior for right shifting signed
numbers. No functional change intended (and the code generated is the
nearly same for aarch64).

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D44285

(cherry picked from commit 8b1925f29c54f5791db3c8dcdf2b67541bb8ab32)

Details

Provenance
impAuthored on Mar 11 2024, 8:15 PM
Differential Revision
D44285: kboot: Avoid UB behavior
Parents
rG649cc3598192: kboot: Create function for error checking.
Branches
Unknown
Tags
Unknown