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 5DEA9423147; Wed, 4 Feb 2026 15:20:04 +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=1770218404; cv=none; b=D6gq/7IKnm1x2N6mo6K7hSZnXPYDVTVB81sld8Zvi7XhUxewiOKUsV8OEvbr4cKO6AE4634rcjWgyzdeYnCm3Of73Q2hmbjBODOeXo8MkG25s3qtVH74fgsalRqECNEpP1KtMdG/M5WRuFzi68BPF4gGAkORRDqaqTzdpjtmYqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218404; c=relaxed/simple; bh=f357uIp2r3UORriSFxH0FFp2+2jzwwsJTaLZfA/u0j4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EtSuFrgeYXk2CA8EMB4c3DV6KCGMDHQvOASOOa73xX/5EmCwYRnxMJ+fr16d8goBlItusgRvG3Z/lq9pyEiys5Nr+R1mnUglhX9i3XFpRYBxJLXxvaVw2pVgAMKuvCssvmVZuYQH6VdpHpktmkO/vqoanaM6Dquzm+gQj3OOtkI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xvwNW21r; 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="xvwNW21r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9442C4CEF7; Wed, 4 Feb 2026 15:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770218404; bh=f357uIp2r3UORriSFxH0FFp2+2jzwwsJTaLZfA/u0j4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvwNW21rPDTfxrMxuBK2Yzhb9tiQop41YX5Atu5npOOx+7Tnm69XMb5gSBoYy6T2n CPV+MMQ73bSG4JdaM0PyXslIjrYku/dv+KeoJzn0OZryd6Mpbd0nOPAgYm31DSPamG QWk+4512R42zPKdj4n7uLtwDaeNMxhlKMYA2YZkk= 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 6.6 21/72] gpiolib: acpi: use BIT_ULL() for u64 mask in address space handler Date: Wed, 4 Feb 2026 15:40:24 +0100 Message-ID: <20260204143846.391660467@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143845.603454952@linuxfoundation.org> References: <20260204143845.603454952@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.6-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 86de8740c0d46..69d4297ae5754 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1228,7 +1228,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