Page MenuHomeFreeBSD

1 << 31 redux
AbandonedPublic

Authored by eadler on Jan 11 2018, 11:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 11:40 PM
Unknown Object (File)
Sun, Apr 14, 4:38 AM
Unknown Object (File)
Sat, Apr 6, 4:06 PM
Unknown Object (File)
Mar 18 2024, 6:05 PM
Unknown Object (File)
Jan 13 2024, 11:33 AM
Unknown Object (File)
Dec 20 2023, 3:51 AM
Unknown Object (File)
Nov 18 2023, 9:12 PM
Unknown Object (File)
Nov 18 2023, 6:22 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.