Page MenuHomeFreeBSD

Fix type errors.
ClosedPublic

Authored by kib on Jan 23 2021, 10:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 4:06 PM
Unknown Object (File)
Sun, Oct 27, 9:28 AM
Unknown Object (File)
Sun, Oct 27, 9:27 AM
Unknown Object (File)
Sun, Oct 27, 9:27 AM
Unknown Object (File)
Sun, Oct 27, 9:27 AM
Unknown Object (File)
Sun, Oct 27, 9:27 AM
Unknown Object (File)
Sun, Oct 27, 9:17 AM
Unknown Object (File)
Fri, Oct 18, 7:24 AM

Details

Summary

Target value for val has uint32_t type, not uint, adjust used constant.
Cast val to unsigned so that left and right sides of comparision operator do not expose different signed types of same range.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jan 23 2021, 10:51 AM
kib created this revision.

Will this give an is always false warning? Should we use strtoll instead

Add header for UINT32_MAX.

This still breaks buildworld on several archs:

/usr/src/usr.bin/elfctl/elfctl.c:258:35: error: use of undeclared identifier 'UINT32_MAX'

else if ((unsigned long)val > UINT32_MAX)

adding stdint.h fixes it

huh, bad timing

Will this give an is always false warning? Should we use strtoll instead

For me, the build worked. Are you worried about gcc?

For me, the build worked. Are you worried about gcc?

Ah, yes I see it builds fine with this change, but e.g. 0xffffffff doesn't work on 32-bit with long.

Switch to unsigned long long/strtoll

This revision is now accepted and ready to land.Jan 23 2021, 3:21 PM
This revision was automatically updated to reflect the committed changes.