HomeFreeBSD

linuxkpi: Correct kstrtobool

Description

linuxkpi: Correct kstrtobool

Implement the exact same logic as in Linux:

  • Accept 'e', 't', 'y', '1', "on" for true.
  • Accept 'd', 'f', 'n', '0', "of" for false.
  • Disregard any characters beyond that.
  • Check that the string is not null, but don't check the result pointer.

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D54451

(cherry picked from commit f86148d2777d4d7985ed8f4ae957c41c44bd2484)

Details

Provenance
desAuthored on Jan 3 2026, 9:09 AM
Reviewer
bz
Differential Revision
D54451: linuxkpi: Correct kstrtobool
Parents
rG445f0d4b27d3: linuxkpi: Don't clobber result on failure
Branches
Unknown
Tags
Unknown