From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Josh Poimboeuf" <jpoimboe@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>
Subject: Re: [PATCH v2] iio: imu: bmi160: Remove potential undefined behavior in bmi160_config_pin()
Date: Sun, 15 Mar 2026 12:22:00 +0000 [thread overview]
Message-ID: <20260315122200.5b88b585@jic23-huawei> (raw)
In-Reply-To: <26ee13c084488bb66aec8e240e416e3e43f3b697.camel@gmail.com>
On Tue, 10 Mar 2026 14:57:19 +0000
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Mon, 2026-03-09 at 20:45 -0700, Josh Poimboeuf wrote:
> > If 'pin' is not one of its expected values, the value of
> > 'int_out_ctrl_shift' is undefined. With UBSAN enabled, this causes
> > Clang to generate undefined behavior, resulting in the following
> > warning:
> >
> > drivers/iio/imu/bmi160/bmi160_core.o: warning: objtool: bmi160_setup_irq() falls through to next
> > function __cfi_bmi160_core_runtime_resume()
> >
> > Prevent the UB and improve error handling by returning an error if 'pin'
> > has an unexpected value.
> >
> > While at it, simplify the code a bit by moving the 'pin_name' assignment
> > to the first switch statement.
> >
> > Fixes: 895bf81e6bbf ("iio:bmi160: add drdy interrupt support")
> > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > Closes: https://lore.kernel.org/a426d669-58bb-4be1-9eaa-6f3d83109e2d@app.fastmail.com
> > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
prev parent reply other threads:[~2026-03-15 12:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 3:45 Josh Poimboeuf
2026-03-10 11:36 ` Andy Shevchenko
2026-03-10 16:29 ` Josh Poimboeuf
2026-03-10 14:57 ` Nuno Sá
2026-03-15 12:22 ` Jonathan Cameron [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=20260315122200.5b88b585@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=arnd@arndb.de \
--cc=dlechner@baylibre.com \
--cc=jpoimboe@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=noname.nuno@gmail.com \
--cc=nuno.sa@analog.com \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®