From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6416606A329 for ; Mon, 30 Nov 2026 12:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Ql4DB2gK; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Wz5/K1qE DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Cc:To:Subject: From:Message-ID:MIME-Version:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=JOqjDRey4cxfdwFRRzI1HIhwQtc+Z64lxisv9buFSRI=; b=Ql4DB2gKUwWBr/zuG/GWhoTaRB WThGfSNv0mOYVtR9UG/YGQUyC2wiVOU2SRW3kltOJd4w+sJScb2T+PyudcmeL5S2TgrbYq5XOQWRs 6iAY3daWzsxCAuut4Oxa8uJEU4L4WM6JfhrQb4vi4+Q6ul+UA2YurPC5Xv38OXjJHLPBhVYSprxsm IzMRWXoyj7C+S7LKdSklKwD3jQyj9dp9y0e0DHrTAycwwyVJOrAbALRYwMPcP92sA5NPGB39+F6Aq 483syVYhEA/K330ksJuDYRAvWtSnsXY3V8kPRMRcqP+kqYMdL6cuu/QuMC7R2AMWKJDQKUbEGfBja EKWGfrxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY034-00000004RQC-48gH; Mon, 30 Nov 2026 11:59:58 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY02x-00000004RLc-0p9B for linux-nvme@lists.infradead.org; Mon, 30 Nov 2026 11:59:51 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5239260E2B; Mon, 30 Nov 2026 11:59:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE6241F0092C; Mon, 30 Nov 2026 11:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796039989; bh=JOqjDRey4cxfdwFRRzI1HIhwQtc+Z64lxisv9buFSRI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Wz5/K1qEz2BSpTOtzyPAAYf8aCmY67HoqDGoeDt8N3vP9ckqaoweQudOnKeeoKSvP XwF3Qp82QH22tU0OfVUySjQ0OEAdPv7klhwEjrCGTaCaoXI3dJ36mieTrsYa5vnd3d 58JJ0NeSaf+hRdaPQMAG+OHx467+qUaoSSiM/hF3Me7ay58ptgN1Ddkhks96+dwmNi AnMlrV8cAyD4G2Vis8Iunyq5KzCDqfxBgr6PjpCf/W3S2nF+0wgmsdaBWYR/tcPqP2 jOtQwYFR1jfSjZ3KWLfiLWILUpd9UK1zVSlRDoRoUJggJMSYOOss/8GW6PbGexTprH wsuEf3fTkznYQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] nvmet: fix one-byte overflow in configfs string show callbacks To: "Lin Tzu Yang" Cc: linux-nvme@lists.infradead.org In-Reply-To: <20261130114711.842577-1-rongh7426@gmail.com> References: <20261130114711.842577-1-rongh7426@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 11:59:49 +0000 X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Linux-nvme" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] nvmet: snprintf() in nvmet_passthru_device_path_show() mismatches changelog -- commit 439334c02309f8c7dc424a02bda5bf34576398b8 Author: Lin Tzu Yang nvmet: fix one-byte overflow in configfs string show callbacks This commit replaces sprintf() with scnprintf(..., PAGE_SIZE, ...) in nvmet_ns_device_path_show(), nvmet_host_dhchap_key_show(), and nvmet_host_dhchap_ctrl_key_show() to prevent a one-byte buffer overflow on 4095-byte attribute values. > Use scnprintf() with PAGE_SIZE, as the passthru device_path show > already does. A value that does not fit loses its trailing newline > instead of overflowing the buffer. [Severity: Low] Does nvmet_passthru_device_path_show() need to be converted to scnprintf() as well, or should the commit message be adjusted? drivers/nvme/target/configfs.c:nvmet_passthru_device_path_show() { ... ret =3D snprintf(page, PAGE_SIZE, "%s\n", subsys->passthru && subsys->passthru->ctrl_path ? subsys->passthru->ctrl_path : ""); ... } nvmet_passthru_device_path_show() currently uses snprintf() rather than scnprintf(). When ctrl_path is 4095 bytes long, snprintf() drops the newline, writes a NUL terminator at page[4095], and returns 4096, which fill_read_buffer() accepts (count <=3D SIMPLE_ATTR_SIZE) so configfs copies the trailing NUL byte to userspace instead of returning 4095 bytes. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130114711.8425= 77-1-rongh7426@gmail.com?part=3D1