Page MenuHomeFreeBSD

ipfilter: Cast uintmax_t values to size_t when adding to a pointer.
ClosedPublic

Authored by jhb on Sep 27 2022, 5:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 19, 3:30 AM
Unknown Object (File)
Mon, Mar 16, 11:40 AM
Unknown Object (File)
Sat, Mar 14, 1:10 PM
Unknown Object (File)
Sat, Mar 14, 1:07 PM
Unknown Object (File)
Feb 7 2026, 5:28 PM
Unknown Object (File)
Jan 1 2026, 10:35 AM
Unknown Object (File)
Dec 15 2025, 11:32 PM
Unknown Object (File)
Dec 11 2025, 4:13 PM

Details

Summary

GCC warns about the mismatched sizes on 32-bit platforms where
uintmax_t is larger in size than a pointer.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47568
Build 44455: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Sep 27 2022, 5:41 PM
This revision is now accepted and ready to land.Sep 27 2022, 6:09 PM

assuming that you know that these can never be truncated, and that truncation won't cause a problem.

In D36753#834438, @imp wrote:

assuming that you know that these can never be truncated, and that truncation won't cause a problem.

If you have an offset bigger than size_t, you don't have a valid pointer (or you've wrapped around anyway). In practice arg2 are fairly small values that are offsets of fields in structures.