From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBFF7426EB7; Tue, 31 Mar 2026 16:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975267; cv=none; b=ks20OAYgeNgQxcBfKLNYMI3zUGuQxXJNK05UV91rUEy0p21FUlZ1Uo7Lfeq2rWrx8EbyHtaiENRT1CTlQu+ErvChOhc7tXxgZ4rKMcazvVNsX7Kd9HIPpdfhtfI0B2NlO8HIQrhFjCzJUFPcxeEu8TOvhAAyEyheJ7O2TTUNUSI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975267; c=relaxed/simple; bh=XSBvy4jytaP7PIdVefBB3rYK5sTf9Qo0R5jtOXeaytY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+nwjHpjf2pTz4KT4FP0mkXsoxlrqPu9nUKFLWSBJPosvZ6oV985/iOMmJREX+ywjJEHmsG++Z7u1W/j/yEYALYXPU3lUm0ui5Nuk62G2nd7NXbe0nHBMHcKjJWERlXXynE5k60iccjbXFzzTd1s/nO0USeiEOiZeQ9j6vJNsRU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NkK8quF5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NkK8quF5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62938C19424; Tue, 31 Mar 2026 16:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774975267; bh=XSBvy4jytaP7PIdVefBB3rYK5sTf9Qo0R5jtOXeaytY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkK8quF5tkIqRahAf2DcvZ+VW9cQOQyhERDHycC9c1AuSvW2zROrEOxz2yo40iPTx dlH992nO9IB29/rMx/8VyQEFbnWaVSx6HTbzIiltrkIjW+jAVw+ARaNfGD2fMrzCjp cdOnEl11bGeJJxW/oopfQzhGzJaZf3w6Q7kPM2CE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sanman Pradhan , Guenter Roeck Subject: [PATCH 6.19 227/342] hwmon: (peci/cputemp) Fix off-by-one in cputemp_is_visible() Date: Tue, 31 Mar 2026 18:21:00 +0200 Message-ID: <20260331161807.319850700@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161758.909578033@linuxfoundation.org> References: <20260331161758.909578033@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sanman Pradhan commit b0c9d8ae71509f25690d57f2efddebf7f4b12194 upstream. cputemp_is_visible() validates the channel index against CPUTEMP_CHANNEL_NUMS, but currently uses '>' instead of '>='. As a result, channel == CPUTEMP_CHANNEL_NUMS is not rejected even though valid indices are 0 .. CPUTEMP_CHANNEL_NUMS - 1. Fix the bounds check by using '>=' so invalid channel indices are rejected before indexing the core bitmap. Fixes: bf3608f338e9 ("hwmon: peci: Add cputemp driver") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan Link: https://lore.kernel.org/r/20260323002352.93417-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/peci/cputemp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwmon/peci/cputemp.c +++ b/drivers/hwmon/peci/cputemp.c @@ -319,7 +319,7 @@ static umode_t cputemp_is_visible(const { const struct peci_cputemp *priv = data; - if (channel > CPUTEMP_CHANNEL_NUMS) + if (channel >= CPUTEMP_CHANNEL_NUMS) return 0; if (channel < channel_core)