lkml.org 
[lkml]   [2026]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] iio: imu: bmi160: Remove potential undefined behavior in bmi160_config_pin()
On Mon, Mar 09, 2026 at 08:45:45PM -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.

Thanks!
Are you aware of this: https://bugzilla.kernel.org/show_bug.cgi?id=219192?
Perhaps also needs to be addressed? (I haven't checked if it's already done
or not.)

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

--
With Best Regards,
Andy Shevchenko



\
 
 \ /
  Last update: 2026-03-10 12:38    [W:0.134 / U:16.777 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog