Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796355299; b=k7qKB5agtCF9w4pl+QH4xWRWHqmsbDyCbtWvP9iRFPJ7cVM2LtcN9YRlrdpuT1klyQdj ntp/28i4IsKaJDPCFQK95W6RW1f6RDVufuYUNTH/trFVl8s/57K6UNkYdWEKNXHboskVm aiqfyqGiv94CXBQKQrN2FqSXJ44caIgbs3it2T4HzDvZR+F0NR2MCHURLqLOWtuY3g+0z ojvg/lLb4dObP5EhwVCy3QQX7JYCqoqPkuvR7uyZMyrRUp3T81eQd32Ks+7XT6CKUDedO f6nsFGcUCrdsWH9WwUgKY+X2/XUBQCvlx6MBw317yffamoQCH9Hh/twxxA9q9TjXnaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796355299; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=5+68Im/ezpCV/J98EY0WLjwAZhlm/L+2AyxjG0SNixk=; b=TGwL1FVQfkAEBxUGaJCfaCx+sTy0hi3mGJY2wqkn+RsEbEEoXmfrLITKximtCLE2S8wg bMLXr9t8GTfsiwXgGdpgdd/qE7MLSq+4vpuP/cjgq1ngQ/nDUJh/N4bf5OKptG7ZkcWnV sVbdsuA13lNHybnjch8AF9eAcCKyVxGl9KSfbBd/0C5zbf8AJI4Ld96GvGP+rCl4jbGYA Y2sQ49VYedIWeO+1T/pWXKPiJ1DS0SaMzCs4g5VKwNtj/C7LjJ+raIupG9izu11jiAmub MHh1Jdw6b2ATOK50dCGnZ4rVXuI8WD8Fd9fb9ANzSL5rKpvULsPI8O8YHSVXWU7GgEg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GM0xV0Ay; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86B75606A322; Fri, 4 Dec 2026 03:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GM0xV0Ay Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE131F000C2; Fri, 4 Dec 2026 03:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796355299; bh=5+68Im/ezpCV/J98EY0WLjwAZhlm/L+2AyxjG0SNixk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GM0xV0AyMh42MSwWyNYr0toskC0hIIwy/3g2I4ixaapHtoaYIAfU/+n3ASAWwssxe IfEoAz4vV1evbKEB3egP9kS0JsGK1nQlEHZ5DO0Awl96oJSBPa8SHMo2NboCl5OPjX B+jV2F6Pt6/isjiTnA0EduSEvNQk/55SsHJNz239KdQsCaFo+oMKqdDdDlQJm+IOdA q2wlzFRDO4yrItvkbZAV+dozT4X4hEVagMZJxLxN1MZIropzRXOOL8MamWp4NKPi7A z+Wx07ZtiNjqowRAXAkxDx5S4aa6JevmAJdCTh3DwSSBp4yg9s+qYo69Gag1gCLOvT VjBSYOJdiU1vA== From: Sasha Levin To: stable@vger.kernel.org Cc: Kees Cook , Guenter Roeck , Rob Herring , Jean Delvare , linux-hwmon@vger.kernel.org, Sasha Levin Subject: [PATCH 6.6.y 1/3] hwmon: (nct6775-platform) Explicitly initialize nct6775_sio_names indexes Date: Thu, 3 Dec 2026 22:34:54 -0500 Message-ID: <20261204033437.2433648-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120242-pacifism-dropper-efea@gregkh> References: <2026120242-pacifism-dropper-efea@gregkh> X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Kees Cook [ Upstream commit efe86092ab316db8d3c6e98f57b193511a09a073 ] Changing the "kinds" enum start value to be 1-indexed instead of 0-indexed caused look-ups in nct6775_sio_namesp[] to be misaligned or off the end. Coverity reported: *** CID 1571052: Memory - illegal accesses (OVERRUN) drivers/hwmon/nct6775-platform.c:1075 in nct6775_find() 1069 sio_data->kind == nct6793 || sio_data->kind == nct6795 || 1070 sio_data->kind == nct6796 || sio_data->kind == nct6797 || 1071 sio_data->kind == nct6798 || sio_data->kind == nct6799) 1072 nct6791_enable_io_mapping(sio_data); 1073 1074 sio_data->sio_exit(sio_data); vvv CID 1571052: Memory - illegal accesses (OVERRUN) vvv Overrunning array "nct6775_sio_names" of 13 8-byte elements at element index 13 (byte offset 111) using index "sio_data->kind" (which evaluates to 13). 1075 pr_info("Found %s or compatible chip at %#x:%#x\n", 1076 nct6775_sio_names[sio_data->kind], sioaddr, addr); 1077 1078 return addr; 1079 } 1080 Initialize the string list with explicit indexes. Cc: Guenter Roeck Cc: Rob Herring Cc: Jean Delvare Cc: linux-hwmon@vger.kernel.org Fixes: 10a0575ea09d ("hwmon: nct6775-i2c: Use i2c_get_match_data()") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20231116140144.work.027-kees@kernel.org Signed-off-by: Guenter Roeck Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126") Signed-off-by: Sasha Levin --- drivers/hwmon/nct6775-platform.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index b09fd5791db8e..33159970a3754 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -23,19 +23,19 @@ enum sensor_access { access_direct, access_asuswmi }; static const char * const nct6775_sio_names[] __initconst = { - "NCT6106D", - "NCT6116D", - "NCT6775F", - "NCT6776D/F", - "NCT6779D", - "NCT6791D", - "NCT6792D", - "NCT6793D", - "NCT6795D", - "NCT6796D", - "NCT6797D", - "NCT6798D", - "NCT6796D-S/NCT6799D-R", + [nct6106] = "NCT6106D", + [nct6116] = "NCT6116D", + [nct6775] = "NCT6775F", + [nct6776] = "NCT6776D/F", + [nct6779] = "NCT6779D", + [nct6791] = "NCT6791D", + [nct6792] = "NCT6792D", + [nct6793] = "NCT6793D", + [nct6795] = "NCT6795D", + [nct6796] = "NCT6796D", + [nct6797] = "NCT6797D", + [nct6798] = "NCT6798D", + [nct6799] = "NCT6796D-S/NCT6799D-R", }; static unsigned short force_id; -- 2.53.0