Page MenuHomeFreeBSD

1 << 31 redux
AbandonedPublic

Authored by eadler on Jan 11 2018, 11:59 AM.

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 OK
Unit
No Unit 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.