From nobody Tue Sep 01 09:04:10 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hZ0KQ3nyvz6qVLH for ; Tue, 01 Sep 2026 09:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hZ0KQ1QSrz3F0M for ; Tue, 01 Sep 2026 09:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788253450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vgsgi3MwRV8+AVNA95GjVQWtM2Ja9UAuQI1EyA6Bs2s=; b=Fkv2owOkFWytqLKcMACh/nFFKYMbZFGJr43RJpJ6ZpSiIwz80WCjAper2DRFZ2+jcVXdeu fXxzKZSYw9xrTDy8n5tcjo+kbgMdeMyXq5vI0zuPddueNi4WRGQwpqFSlovuS9L5NzWfOG E9bWOeyN86ucyC9KpByu0tqvxQ0DWANvWfwuWX+JmgfdxhqfvdSDd5UsaHimhbfdFf0TBG UOADtb2ML1yFIfECskTVXFfxPBwIbHgBBvLrhzXIKfRHGKmkJGj4cz+Z5esBZbwuqXesC+ 9AlfiC94Bp8HAAiCcRa41e+7hQRPrLAm4pBE39wGDEsig9tf4gQFbvllh3+skw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788253450; a=rsa-sha256; cv=none; b=yWmIPOVTIJYevXW1Otv6wPgwr/8tyCEx3cssYZnZutHmjPBNYJ1nV4AwjE+msPT7N6OAe/ nOQfLsQQeQGWxYKhnvdbI+6hGuS80AdJDYVF+h3jSBvQX13mxUPxPpWhq85aYa0Zot9G3K LrcUpmfmgA1rWulwTXMlBRBEk8ZQKgPmdPtapD/W3gtmeip1EqebBC03NEM9V8kMwjWmtN uAjdwl4t/suPNmizL0zsSAp+WpbeNJZJ9SvHnIz7OSn5742t4bWt+nQTKq78jGNC8DiIx+ 5CTS6NJ0yxGpBLJtyrHUMm85xQvdpHtgfKCTYgZbSGb2hxCN5wjma2WSfIZHUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788253450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vgsgi3MwRV8+AVNA95GjVQWtM2Ja9UAuQI1EyA6Bs2s=; b=f+HLqqQH0CzkVTK78IF7aXtMcTXEyDDjYDwDEbxkH2ENNNQeLOPu1tzBma7svRUdbnn57I UmGA8xC0PT2rX8Ai2FEe2kfWWuy3cWtlVZ3WAevsELUfB9V/4zrRO4BMscus7i3aq3Rv6F bEWGlqbreBmN0pFSH3+BDj48IJPbzyydY3a7Ut9HBKOpfrWcWSPe9WOW0YkNHEnZR/eYd3 AqHlKuhZ8if2jybDw2Odkii4qHatdcKPBCBtET+lJAJyUENjzvCpqpQMRm5NF08Y7XZesg 8UZW0xD/7a9kDbs1a+mELbCv+ScTTMcK+lY0nAd6Bzx8TrmLGoWjo2oD9sWmdQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hZ0KQ0VXtzs7d for ; Tue, 01 Sep 2026 09:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25aa9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 01 Sep 2026 09:04:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Sobczyk, Pawel From: Krzysztof Galazka Subject: git: aa85e7aa36bb - stable/15 - ix(4): Sanitize negative error codes List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kgalazka X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: aa85e7aa36bb9651130ea6f25e830235db4e5f5c Auto-Submitted: auto-generated Date: Tue, 01 Sep 2026 09:04:10 +0000 Message-Id: <6a96950a.25aa9.15dfeb35@gitrepo.freebsd.org> The branch stable/15 has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=aa85e7aa36bb9651130ea6f25e830235db4e5f5c commit aa85e7aa36bb9651130ea6f25e830235db4e5f5c Author: Sobczyk, Pawel AuthorDate: 2026-08-18 08:10:54 +0000 Commit: Krzysztof Galazka CommitDate: 2026-09-01 09:03:21 +0000 ix(4): Sanitize negative error codes 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 Reviewed by: kbowling, erj, milosz.linkiewicz_intel.com Tested by: Mateusz Moga Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D57642 (cherry picked from commit 33e2eac3e3e738daa95a06f42d6c661b87ad9aac) --- sys/dev/ixgbe/if_ix.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index f08405059677..abe226a5e11a 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1592,8 +1592,9 @@ ixgbe_nvm_access_ioctl(struct ixgbe_softc *sc, struct ifdrv *ifd) size_t ifd_len = ifd->ifd_len; size_t malloc_len; device_t dev = sc->dev; + s32 status; u8 *nvm_buffer; - s32 error = 0; + int error = 0; /* * ifioctl forwards SIOCxDRVSPEC to iflib without conducting @@ -1642,10 +1643,10 @@ ixgbe_nvm_access_ioctl(struct ixgbe_softc *sc, struct ifdrv *ifd) (nvm_buffer + sizeof(struct ixgbe_nvm_access_cmd)); /* Handle the NVM access request */ - error = ixgbe_handle_nvm_access(hw, cmd, data); - if (error) { + status = ixgbe_handle_nvm_access(hw, cmd, data); + if (status) { device_printf(dev, "%s: NVM access request failed, error %d\n", - __func__, error); + __func__, status); } /* Copy the possibly modified contents of the handled request out */ @@ -1657,6 +1658,20 @@ ixgbe_nvm_access_ioctl(struct ixgbe_softc *sc, struct ifdrv *ifd) goto cleanup_free_nvm_buffer; } + /* Convert private status to an error code for proper ioctl response */ + switch (status) { + case IXGBE_SUCCESS: + error = 0; + break; + case IXGBE_ERR_OUT_OF_RANGE: + error = ENOTTY; + break; + case IXGBE_ERR_PARAM: + default: + error = EINVAL; + break; + } + cleanup_free_nvm_buffer: free(nvm_buffer, M_IXGBE); return (error);