From nobody Tue Dec 30 13:25:29 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A17DFC47072 for ; Wed, 15 Nov 2023 03:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234473AbjKODn0 (ORCPT ); Tue, 14 Nov 2023 22:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234529AbjKODnN (ORCPT ); Tue, 14 Nov 2023 22:43:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E686110; Tue, 14 Nov 2023 19:43:10 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A836C433C8; Wed, 15 Nov 2023 03:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700019790; bh=yN8yC7Ian6+pDeHYcYG2ppXHfWI5M/c+8L5DzjrbU54=; h=From:To:Cc:Subject:Date:From; b=ZXSgseGFAHfcIYEJw9+OoJvWCuThEJlNJWAURgfnN5CW6uTLIoQYvyhOb0dfmH7a/ 7DiklAIBw6KKD8XmRkE28G8j2SSDYZZmWpStEIoCctuMBW/fOVbQEcXqrZAdaAYRS8 IHGhNQ35rwppJp1k42p04/PIKzOpqVINpBhg+CkFO/1tzaZ6uXh3g2zu7wo+QIbIN0 N0W6D/VYn2mspLq+OLmftYUNuzL02A+ERmjN8rX0WZz3CzPbg3O6I6ZLNpI+3rbMGn hycTNOnOj8mEyMiKAwOQcZGX6Oi+9cJ7E41iiVh1afXCBKX5M8xAt1sbC9EGBFRpd4 8CE1Utt4Wzffw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sam Protsenko , Thierry Reding , Sasha Levin , linux-pwm@vger.kernel.org Subject: [PATCH AUTOSEL 4.14] pwm: Fix double shift bug Date: Tue, 14 Nov 2023 22:42:54 -0500 Message-ID: <20231115034255.1244454-1-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 4.14.329 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit d27abbfd4888d79dd24baf50e774631046ac4732 ] These enums are passed to set/test_bit(). The set/test_bit() functions take a bit number instead of a shifted value. Passing a shifted value is a double shift bug like doing BIT(BIT(1)). The double shift bug doesn't cause a problem here because we are only checking 0 and 1 but if the value was 5 or above then it can lead to a buffer overflow. Signed-off-by: Dan Carpenter Reviewed-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Sam Protsenko Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- include/linux/pwm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pwm.h b/include/linux/pwm.h index bd7d611d63e91..c6e981035c3fd 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -44,8 +44,8 @@ struct pwm_args { }; =20 enum { - PWMF_REQUESTED =3D 1 << 0, - PWMF_EXPORTED =3D 1 << 1, + PWMF_REQUESTED =3D 0, + PWMF_EXPORTED =3D 1, }; =20 /* --=20 2.42.0