HomeFreeBSD

FreeBSD: Fix integer conversion for vnlru_free{,_vfsops}()

Description

FreeBSD: Fix integer conversion for vnlru_free{,_vfsops}()

When reviewing #13875, I noticed that our FreeBSD code has an issue
where it converts from int64_t to int when calling
vnlru_free{,_vfsops}(). The result is that if the int64_t is `1 <<
36`, the int will be 0, since the low bits are 0. Even when some low
bits are set, a value such as ((1 << 36) + 1) would truncate to 1,
which is wrong.

There is protection against this on 32-bit platforms, but on 64-bit
platforms, there is no check to protect us, so we add a check.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13882

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Sep 14 2022, 7:51 PM
GitHub <noreply@github.com>Committed on Sep 14 2022, 7:51 PM
Parents
rG4a6e8b99f517: Add assertion to dsl_dataset_set_compression_sync
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGccec88f11a44: FreeBSD: Fix integer conversion for vnlru_free{,_vfsops}() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Sep 14 2022, 7:51 PM