From nobody Sat Sep 12 18:19:08 2026 X-Original-To: dev-commits-src-all@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 4hj06n5Jlpz6sX8h for ; Sat, 12 Sep 2026 18:19:13 +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 4hj06n4H2Lz4qdh for ; Sat, 12 Sep 2026 18:19:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789237153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9FJQRIoD7srgIEEq5D3Rz+2YsBSc2P7WkhpiFL9vd5Q=; b=QogQiUu6nT8NHPfPDUOqGTN/g1BxbDd1t+8TREvOdATTqD6ej2UgL0PP8/bq2ZQzJpgic7 GhAsHczbUi2VcWC1Qc3wZ6otWyzPu24xql8cbvK8TbP7XX8lZxefs+bPZtKgMz2o8/o5yw 84sBVzFxJijAcFNC7HvlB+vGSHVcxWnLYpU/tggHUwyiL9+fQPPFoWKzxrlUVo4q5/17Xz EtfEZ/kVkEbs2S5wvmeOG2CvxKUWlXz5s9+fO37Cg87ged/lu0qRtHX/uQK5WStn7HYHa/ WHgSQp96k56g6Aa0qv+0gZGUqIw81O4yVPFYB7B5akgukLpZqDrt8bvmEvr2Mw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789237153; b=pctRnZRQgL5Iov7CER+db5cZ8goBwfYay4GwyDmdK+SvrDTHRkfONOQn/aQwamMyQKBqjn SnNP1wp3QbCiI7vyPJKwXW0gIecyA/Dtln9r9aAK3ruUC7jJ+L2DNYt2xMAQMFjvieEqqK 2XZXijATmYFzVyhWxyuMjqEO9jEEUR21HlmPW1ZJySTI5br1S0iUydanWBMVvpLHZ2owMJ L5uhA8GT0QBu4RlaJLiH/EVdue2hO1ElMj1grGZuOhrfr3RCiYEA3Q2rNLKE+e/2ydFvxo cAwY2Tx8wKi1Gzsggxks+spZkBrCE51WSnwj3LJccRrYMJeI9fpR/ZrCbY4JBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789237153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9FJQRIoD7srgIEEq5D3Rz+2YsBSc2P7WkhpiFL9vd5Q=; b=fLSHi4fijKw9nwe/raYdVUPSI8wqenktvG9/Rk9ymP8wG8mCBEr+MmdTkzBnutePOlrAH/ zLgHyrfBIzJlRgnUvZkf4BJEgq2dxRGeBi+dGPYFgflo9m8LRqXZZT/3l2H3Y5GAIiy67e jyBKDDu5yIA1DbWAhw3ndVNcHUf6uNWF8S4LIhuEbATHKCUZ4n1uIrSp5wSr1hgeF/dxFT t/ZKkIPvRQZq4q26GVr17Pgy1lgLfihgv8sIMU2BXoVmY/lAmukyfrioElsm9496ho0/SG HFgkFJIZeplbxEcIqElx/LxPQt8qvnDGdLv0WuxYwaDRNSlAZrU6eOGgSuG7bQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hj06n3Lvwz17fn for ; Sat, 12 Sep 2026 18:19:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 457a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 12 Sep 2026 18:19:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 79e2a46a6afd - main - nvmecontrol: Fix APST transition encoding List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79e2a46a6afda1b762c75cb308a474c9ed0cda4c Auto-Submitted: auto-generated Date: Sat, 12 Sep 2026 18:19:08 +0000 Message-Id: <6aa5979c.457a9.6d5f00a3@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=79e2a46a6afda1b762c75cb308a474c9ed0cda4c commit 79e2a46a6afda1b762c75cb308a474c9ed0cda4c Author: Warner Losh AuthorDate: 2026-09-11 06:14:00 +0000 Commit: Warner Losh CommitDate: 2026-09-12 16:59:16 +0000 nvmecontrol: Fix APST transition encoding Use uin64_t casts to encode data sent to avoid overflows. Fixes: 35793364d722 Sponsored by: Netflix --- sbin/nvmecontrol/power.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sbin/nvmecontrol/power.c b/sbin/nvmecontrol/power.c index fca152c3924a..1ba28deb6c16 100644 --- a/sbin/nvmecontrol/power.c +++ b/sbin/nvmecontrol/power.c @@ -174,7 +174,8 @@ power_apst_data_generate(struct nvme_controller_data *cdata, /* Wait 50x the latency before each transition. */ itpt = MIN(latency * 50, (1 << 24) - 1); - data[i - 1] = htole64(itpt << 8 | i << 3); + data[i - 1] = htole64((uint64_t)itpt << 8 | + (uint64_t)i << 3); } } @@ -191,14 +192,15 @@ power_apst_data_parse(struct nvme_controller_data *cdata, if (sscanf(token, "%i:%i", &itps, &itpt) != 2) errx(EX_USAGE, "cannot parse provided configuration"); - if (itps < 0 || itps >= cdata->npss) + if (itps < 0 || itps > cdata->npss) errx(EX_USAGE, "invalid ITPS=%d (must be 0..%d)", itps, cdata->npss); if (itpt < 0 || itpt >= 1 << 24) errx(EX_USAGE, "invalid ITPT=%d (must be 0..%d)", - itpt, 1 << 24); + itpt, (1 << 24) - 1); - data[i] = htole64(itpt << 8 | itps << 3); + data[i] = htole64((uint64_t)itpt << 8 | + (uint64_t)itps << 3); } }