Page MenuHomeFreeBSD

ix(4): Sanitize negative error codes
Needs RevisionPublic

Authored by pawel.sobczyk_intel.com on Jun 18 2026, 8:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 11, 2:55 PM
Unknown Object (File)
Mon, Aug 10, 11:03 AM
Unknown Object (File)
Sun, Aug 9, 9:20 PM
Unknown Object (File)
Sun, Aug 9, 3:38 AM
Unknown Object (File)
Sat, Aug 8, 2:29 PM
Unknown Object (File)
Sat, Aug 8, 9:23 AM
Unknown Object (File)
Sat, Aug 8, 4:52 AM
Unknown Object (File)
Fri, Aug 7, 9:14 PM

Details

Reviewers
mateusz.moga_intel.com
kbowling
milosz.linkiewicz_intel.com
Group Reviewers
Intel Networking
Restricted Owners Package(Owns No Changed Paths)
Summary

Due to development history FreeBSD driver error codes are reported the same way
as in Linux (as negatives) which is inconsistent with FreeBSD standard. It may
cause unexpected behavior when driver errors are interpreted by a kernel
as syscall handler return values.
This patch converts error codes from negative to positive values for
NVM access functions.

Signed-off-by: Pawel Sobczyk <pawel.sobczyk@intel.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73971
Build 70854: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jun 18 2026, 8:46 AM
This revision is now accepted and ready to land.Tue, Aug 11, 7:30 AM
kbowling added a subscriber: kbowling.

Take a look at sys/dev/ice/ice_lib.c ice_handle_nvm_access_ioctl(), I think it is a lot safer way to handle this

This revision now requires changes to proceed.Tue, Aug 11, 3:06 PM

Take a look at sys/dev/ice/ice_lib.c ice_handle_nvm_access_ioctl(), I think it is a lot safer way to handle this

Yeah; this approach is still returning the internal ixgbe error codes which could potentially be misinterpreted regardless of whether they're positive or negative. The ice approach converts them to standard FreeBSD error codes that the kernel would expect to get out of an ioctl.