From mboxrd@z Thu Jan 1 00:00:00 1970 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 E1487C07548 for ; Wed, 15 Nov 2023 03:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbjKODgI (ORCPT ); Tue, 14 Nov 2023 22:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbjKODgC (ORCPT ); Tue, 14 Nov 2023 22:36:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8E3FA; Tue, 14 Nov 2023 19:35:58 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A35C433C7; Wed, 15 Nov 2023 03:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700019358; bh=dYViN4OUK+wSLzWaaS6X3u0p8LN0AZ3u0CQVH6CC28s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eS0zJO/g4rwu0S4xzK4OSoot8QOLclzozc0NbnNqnLhMGLj6AXNkplXBtglHlaP4n b/9hToWPiUYg0CWQpJeMC3ymPNMRjfhySHxH8m3LY5cmqk5zOBNKf/NljZekk4wN/h VJ13q+GwBt+eQLAffCKcYKlaNV/kVMSzMzxeoLe0SdGETVIsmVZMawdNgPZuMjQ7mR 7h3Hf3Z7+Ab0KtzmiWDVAf4OYOhIhHFKVoPT9RKbXGpmdB/TypD7Nd+Z+CEXvTZoFL K0aj/sM9hJKK/MfO/nBMg3KvFab/qSjgEqWWEtzJr9NAwteXFDn+EcXYyFaWrUA8z3 +pRL5tz0yfysw== 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 6.5 6/6] pwm: Fix double shift bug Date: Tue, 14 Nov 2023 22:34:50 -0500 Message-ID: <20231115033459.1228900-6-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115033459.1228900-1-sashal@kernel.org> References: <20231115033459.1228900-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.11 Content-Transfer-Encoding: 8bit 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önig 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 04ae1d9073a74..0755ba9938f74 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -41,8 +41,8 @@ struct pwm_args { }; enum { - PWMF_REQUESTED = 1 << 0, - PWMF_EXPORTED = 1 << 1, + PWMF_REQUESTED = 0, + PWMF_EXPORTED = 1, }; /* -- 2.42.0