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 6ACE43D413D; Wed, 4 Feb 2026 14:59:45 +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=1770217185; cv=none; b=LwkievRtj683giMedpa/REnU2JBt2iHSd3e+MqB3S89EhdJ11JucNRgj8KMRPQl6pgargy3mfS9tDfE9TKRc8AiAlO6n2txtdEW0eay6NpuiaA+MxowGFs6N5PMWxceSfQhKs0o+iScAm9zPAqHl48kS2ph+mbdwfrJVIAn8qUo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217185; c=relaxed/simple; bh=QNIpkEvDbbiQ99qYgKreBciW+5obgd8r7lTnY9DQcP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QWs502IynHzD6s9qzxL0XlK34fjexI2u7sbYdDKaO7sKW4OBiDIoqCXa1suP66pewhRlEHuX6GjHIGYiQ6vb2gAKFbHhhRUKuxGTL6jh2PwRXls3ZU+sxmzj2psDe6YYIbBzIGV6dv6c0A6B34ldoRMkrTEHPYpPo87bgkMYFOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=n0uwIGgm; 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="n0uwIGgm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C39E4C4CEF7; Wed, 4 Feb 2026 14:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217185; bh=QNIpkEvDbbiQ99qYgKreBciW+5obgd8r7lTnY9DQcP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0uwIGgmivPjE3z0TGosf0y+qpr8k/CB7n8dmqJXpSCmZYYdLSo8/s372R3UYAaby nnuUHuaeE2hag2E5t7ay/xTegwP1hQ//NbOr4y5hw5ChZDl+oeGEbvH03p2V+o0yX9 cplbAimah2tKOcByoC/G3g/FPFHCVPfrZr40Edl8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Denis Sergeev , Mika Westerberg , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.15 149/206] gpiolib: acpi: use BIT_ULL() for u64 mask in address space handler Date: Wed, 4 Feb 2026 15:39:40 +0100 Message-ID: <20260204143903.571943834@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143858.193781818@linuxfoundation.org> References: <20260204143858.193781818@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Denis Sergeev [ Upstream commit c0ae43d303e45764918fa8c1dc13d6a5db59c479 ] The BIT() macro uses unsigned long, which is 32 bits on 32-bit architectures. When iterating over GPIO pins with index >= 32, the expression (*value & BIT(i)) causes undefined behavior due to shifting by a value >= type width. Since 'value' is a pointer to u64, use BIT_ULL() to ensure correct 64-bit mask on all architectures. Found by Linux Verification Center (linuxtesting.org) with Svace. Fixes: 2c4d00cb8fc5 ("gpiolib: acpi: Use BIT() macro to increase readability") Signed-off-by: Denis Sergeev Reviewed-by: Mika Westerberg Link: https://lore.kernel.org/r/20260126035914.16586-1-denserg.edu@gmail.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 27e3fb9938049..3e4fd028a82da 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1173,7 +1173,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, mutex_unlock(&achip->conn_lock); if (function == ACPI_WRITE) - gpiod_set_raw_value_cansleep(desc, !!(*value & BIT(i))); + gpiod_set_raw_value_cansleep(desc, !!(*value & BIT_ULL(i))); else *value |= (u64)gpiod_get_raw_value_cansleep(desc) << i; } -- 2.51.0