Page MenuHomeFreeBSD

1 << 31 redux
AbandonedPublic

Authored by eadler on Jan 11 2018, 11:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 1:42 PM
Unknown Object (File)
Oct 2 2024, 5:25 PM
Unknown Object (File)
Sep 15 2024, 8:35 AM
Unknown Object (File)
Sep 8 2024, 2:09 AM
Unknown Object (File)
Sep 7 2024, 11:00 AM
Unknown Object (File)
Sep 5 2024, 9:05 PM
Unknown Object (File)
Sep 1 2024, 4:29 AM
Unknown Object (File)
Aug 26 2024, 8:54 PM

Details

Reviewers
kib
sbruno
manu
Summary

There are a few cases in FreeBSD where the expression (1 << 31) is used.

However this produces undefined behavior as '1' is of type int. (see
6.4.4p5: The type of an unmarked integer constant is the first of the
following list in which its value can be represented: int, long int,
long long int). The shift of 31 is illegal (see 6.5.7p4) if the size
of an int is 32.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14327
Build 14485: arc lint + arc unit

Event Timeline

kib requested changes to this revision.Jan 11 2018, 12:19 PM
kib added a subscriber: kib.
kib added inline comments.
sys/ufs/ffs/ffs_vfsops.c
1177 ↗(On Diff #37788)

This is not needed.

sys/vm/vm_mmap.c
103 ↗(On Diff #37788)

This is not needed.

This revision now requires changes to proceed.Jan 11 2018, 12:19 PM

remove missed instances of casted 1s

erj added a subscriber: erj.

The changes to the Intel ethernet drivers look fine to me.

Changes to dev/mlx4 and dev/mlx5 look fine, but commit them as separate patch.

sys/x86/include/specialreg.h
209

This one is fine.

eadler abandoned this revision.