Page MenuHomeFreeBSD

ix(4): Sanitize negative error codes
ClosedPublic

Authored by pawel.sobczyk_intel.com on Jun 18 2026, 8:46 AM.
Tags
None
Referenced Files
F171443856: D57642.id184238.diff
Fri, Sep 11, 4:05 AM
Unknown Object (File)
Tue, Sep 8, 12:15 AM
Unknown Object (File)
Mon, Sep 7, 1:52 AM
Unknown Object (File)
Fri, Sep 4, 12:09 PM
Unknown Object (File)
Fri, Sep 4, 1:35 AM
Unknown Object (File)
Wed, Sep 2, 9:17 PM
Unknown Object (File)
Wed, Sep 2, 6:49 PM
Unknown Object (File)
Wed, Sep 2, 10:42 AM

Details

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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jun 18 2026, 8:46 AM
This revision is now accepted and ready to land.Aug 11 2026, 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.Aug 11 2026, 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.

This revision is now accepted and ready to land.Thu, Aug 13, 3:30 PM
This revision was automatically updated to reflect the committed changes.