Page MenuHomeFreeBSD

cpucontrol: Be more strict with input validation
ClosedPublic

Authored by markj on Jan 27 2026, 9:23 PM.
Tags
None
Referenced Files
F167925469: D54919.id.diff
Tue, Aug 25, 11:19 AM
F167855626: D54919.id170618.diff
Tue, Aug 25, 1:02 AM
Unknown Object (File)
Mon, Aug 24, 3:02 PM
Unknown Object (File)
Mon, Aug 24, 9:42 AM
Unknown Object (File)
Fri, Aug 21, 11:17 PM
Unknown Object (File)
Tue, Aug 18, 1:06 PM
Unknown Object (File)
Sun, Aug 16, 12:16 PM
Unknown Object (File)
Sun, Aug 16, 11:19 AM
Subscribers

Details

Summary

Avoid truncating 32-bit values. This would have saved me a bit of time
when I was looking at a cpuid leaf on my system and typed 0x80000001f
instead of 0x8000001f.

Diff Detail

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

Event Timeline

markj requested review of this revision.Jan 27 2026, 9:23 PM
usr.sbin/cpucontrol/cpucontrol.c
123

Why not strtoumax() then?

126

I do not think that usage() is required there, user does know what she did, but mis-typed the input.

markj marked 2 inline comments as done.

Handle kib's comments.

usr.sbin/cpucontrol/cpucontrol.c
126

Ok, I just copied the prevailing pattern.

This revision is now accepted and ready to land.Jan 27 2026, 11:22 PM