From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from de1.sohost.pl (de1.sohost.pl [157.90.211.81]) (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 42C7040DFAF; Tue, 26 May 2026 18:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=157.90.211.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779820001; cv=none; b=gEKp7lg4ArRgc3Lmq0dZZQxv6hw00aSe4i0+2ZE481QC3HDV77txebvqFxj0ZlhABM7Zd6vnnPp0PEWzWoPA0e031oCYQwqKJcIrtrtT9u4S7tg3KtFZ3TW8XN2yHZmdoUGGde/r0CXEdIeaO9JJbP1fEY0/lhvO1hX7VVnqj9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779820001; c=relaxed/simple; bh=y6ZKWR248BUZrPvxCPzoBZxd14HbUT2s3WBfCXFBp+M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FrMxPUcS8tnSn1upfcY03mquqAvXraTX5UeCNX2lKBhg5dAfkBqa8w7L4jf4B5w9mBufvSTA+eY2loNemEqdnNIpjEE25TCyZXNixZy4orL4HPkgCsSoKSqxx1lmcdNX06+kMfhGKSo//EkscIdZYSGvfqxwsMH5YNIF0BjEKC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=its.rel.pl; spf=pass smtp.mailfrom=its.rel.pl; dkim=pass (2048-bit key) header.d=its.rel.pl header.i=@its.rel.pl header.b=BbLBTB3u; arc=none smtp.client-ip=157.90.211.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=its.rel.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=its.rel.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=its.rel.pl header.i=@its.rel.pl header.b="BbLBTB3u" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=its.rel.pl; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To: From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=eFVjYmU7OcYPTAcJqlNFDXV6vMOEqFcNJ0Tk42VRm8A=; b=B bLBTB3uEPgqbg/KcHO0gYnr9lMyGoHokst30t3DPfFsy9n7oERBNFMNEDNwh0pmduyIYuarHsUp4g iFzUi5gdGsVsF4l4l61TYNChzRcZlGMM6dq1cUufxa7wnCizLzE+GfutdDTBpDfTaugbk52eUP37/ r+MS+wZwzBtcBkZ+I9ekhoSRzNI0ah/ksy8G4qSpjQp0SsI7w/E71UaqZ5YmvhBy66G/utOeOXfog JqWHClTZRwtwSisSl3eT8iU/+u9i26Gc0Vg3iCarsoTM1/LPFkcS7gWGsyUTIbxxzQ1Fbk8aPfwnt 3rr0ALfa/TxsDaM8hapqTUyyE4k+zYKYw==; Received: from d171-145.icpnet.pl ([109.173.171.145] helo=ewglsoawd.hstl.put.poznan.pl) by de1.sohost.pl with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1wRvrT-007874-QB; Tue, 26 May 2026 19:46:39 +0200 From: Igor Cudnik To: gregkh@linuxfoundation.org Cc: heikki.krogerus@linux.intel.com, mika.westerberg@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Cudnik Subject: [PATCH 1/1] usb: acpi: fix undefined behavior in USB_ACPI_LOCATION_VALID Date: Tue, 26 May 2026 19:43:37 +0200 Message-ID: <20260526174513.15692-1-igor@its.rel.pl> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: igor@its.rel.pl USB_ACPI_LOCATION_VALID uses a signed left shift into the sign bit. Shifting a signed value into the sign bit is undefined behavior. Use BIT(31) instead. Found by cppcheck: drivers/usb/core/usb-acpi.c:221:24: error: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] Fixes: f3ac348e6e045 ("usb: usb-acpi: Set port connect type of not connectable ports correctly") Signed-off-by: Igor Cudnik --- drivers/usb/core/usb-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 489dbdc96f94..583aca6d7669 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -197,7 +197,7 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev) * Private to usb-acpi, all the core needs to know is that * port_dev->location is non-zero when it has been set by the firmware. */ -#define USB_ACPI_LOCATION_VALID (1 << 31) +#define USB_ACPI_LOCATION_VALID BIT(31) static void usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle) -- 2.53.0