From nobody Thu Apr 9 12:04:49 2026 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 AA1E53B8BB2 for ; Mon, 9 Mar 2026 16:03:13 +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=1773072193; cv=none; b=Kjw2RNKC8pKGmkEvh/jdLsJragNnIV4NbUyAoa0P35H7rJd12Bhksh7VBLtc7W9gN/tP0J1qfI3dwjdgnhHv+G379LsVgicrzu6LXaWGe5JCpFx5k6ZFPokMfwIsI2CwhRXybP/JTS7sOVTQhg8Uddh8Y7nfcVMc6rPdoJCmYYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773072193; c=relaxed/simple; bh=Sh9XVKNFjztmYrgXaeD+xy3ZyHog2uAb5uadg6CDJoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HGmLvMuCEzA5csCVtzXI/xJx5L7ksE4ikynoGNctlRP5SipWhN+j/ygJR3tFb4haFgjE5TXHMHVQE23Q8aJ9ppo1HPYxHZ61p0zaPw54XCDRERK8PqqqMEklQddU62cXZMgXYywLzNaciKuTxHa6QjillQQL4q+XTMUR2hxLZ9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e57zvjDu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e57zvjDu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 096E4C2BCAF; Mon, 9 Mar 2026 16:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773072193; bh=Sh9XVKNFjztmYrgXaeD+xy3ZyHog2uAb5uadg6CDJoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e57zvjDuucwCCeh6UYtRh/2heIQ3zGHyNLEHfF1JQX4m1cI+DnqYx8rdoMB0nkxGw qNkbCgDOVZK02lsPnpu6PCDLhVXxtj1ROgDlvGQKjzktmvDVVnyTlbMR7iTs4Smnb8 vtxlLizYq3sEnbS58EX8JHhGDeU4R5wSZfCELbB/p4GC95ADN4zfRaJng8sJDJNWgj z2+K7ilNdKpBqjYqZ188BkFI68FShGShCw5lSd+kwQTVZSSSfuV6d+jTWxA4u1zBCN sMLpYiQXVTw9QlJRnHHkivcqidbt9mJbofyiCNHHeNiryoHlIkMwB4Es2LAkAX7oyF H+Mzl36FF2zjQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Peter Zijlstra , Nathan Chancellor , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko Subject: [PATCH 3/3] iio: imu: bmi160: Remove potential undefined behavior in bmi160_config_pin() Date: Mon, 9 Mar 2026 09:03:07 -0700 Message-ID: <84155f1de72b88d2841b16db97f47ffa4b0f747e.1773071992.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 adding a BUG() if 'pin' has an unexpected value. Cc: Jonathan Cameron Cc: David Lechner CC: Nuno S=C3=A1 Cc: Andy Shevchenko Fixes: 895bf81e6bbf ("iio:bmi160: add drdy interrupt support") Reported-by: Arnd Bergmann Closes: https://lore.kernel.org/a426d669-58bb-4be1-9eaa-6f3d83109e2d@app.fa= stmail.com Signed-off-by: Josh Poimboeuf --- drivers/iio/imu/bmi160/bmi160_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/= bmi160_core.c index 5f47708b4c5d..e5326df75e49 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c @@ -579,6 +579,8 @@ static int bmi160_config_pin(struct regmap *regmap, enu= m bmi160_int_pin pin, int_latch_mask =3D BMI160_INT2_LATCH_MASK; int_map_mask =3D BMI160_INT2_MAP_DRDY_EN; break; + default: + BUG(); } int_out_ctrl_mask =3D BMI160_INT_OUT_CTRL_MASK << int_out_ctrl_shift; =20 --=20 2.53.0