From: Greg KH <gregkh@linuxfoundation.org>
To: Igor Cudnik <igor@its.rel.pl>
Cc: heikki.krogerus@linux.intel.com, mika.westerberg@linux.intel.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] usb: acpi: fix undefined behavior in USB_ACPI_LOCATION_VALID
Date: Wed, 27 May 2026 10:01:41 +0200 [thread overview]
Message-ID: <2026052703-visibly-sureness-dd24@gregkh> (raw)
In-Reply-To: <20260526174513.15692-1-igor@its.rel.pl>
On Tue, May 26, 2026 at 07:43:37PM +0200, Igor Cudnik wrote:
> 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.
SHouldn't this be UBIT(31) instead, if you were really worried about
this shift?
>
> Found by cppcheck:
> drivers/usb/core/usb-acpi.c:221:24: error:
> Shifting signed 32-bit value by 31 bits is undefined behaviour
Is this really a bug? Look at how this is used, is the generated code
"wrong"?
> [shiftTooManyBitsSigned]
>
> Fixes: f3ac348e6e045 ("usb: usb-acpi: Set port connect type of not connectable ports correctly")
Is this fixing a real bug? Or just papering over a buggy tool?
thanks,
greg k-h
prev parent reply other threads:[~2026-05-27 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 17:43 [PATCH 1/1] usb: acpi: fix undefined behavior in USB_ACPI_LOCATION_VALID Igor Cudnik
2026-05-27 8:01 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026052703-visibly-sureness-dd24@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=igor@its.rel.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox