Page MenuHomeFreeBSD

1 << 31 redux
Needs ReviewPublic

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

Details

Reviewers
manu
kib
sbruno
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
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 14327
Build 14485: arc lint + arc unit

Event Timeline

eadler created this revision.Jan 11 2018, 11:59 AM
eadler updated this revision to Diff 37788.Jan 11 2018, 12:12 PM

fix overzelous change

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
eadler updated this revision to Diff 37789.Jan 11 2018, 12:23 PM

remove missed instances of casted 1s

erj accepted this revision as: Intel Networking.Jan 11 2018, 5:54 PM
erj added a subscriber: erj.

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

kib added a comment.Jan 11 2018, 6:32 PM

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

eadler updated this revision to Diff 37855.Jan 12 2018, 6:38 AM

exclude committed parts

manu added a comment.Jan 12 2018, 6:55 AM

arm/allwinner looks fine.

kib added inline comments.Jan 13 2018, 12:26 PM
sys/x86/include/specialreg.h
209

This one is fine.

erj removed a subscriber: erj.
sbruno resigned from this revision.Jan 18 2019, 7:29 PM