Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484151imn; Wed, 27 Jul 2022 11:29:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sol6oKiXtyfk1vRqL/KLGXpyjV/y/1Fk/zhzGX3xU6uMUae0S98IbKXichQnCw/XYR+9gR X-Received: by 2002:a17:907:b17:b0:72a:edb8:7529 with SMTP id h23-20020a1709070b1700b0072aedb87529mr18177126ejl.749.1658946549152; Wed, 27 Jul 2022 11:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946549; cv=none; d=google.com; s=arc-20160816; b=Gu2kN78rdpBI6S8oVrSLGwv9G8avmHs5wdlZ1986LoTr/3U5kfCCKe0SBSbaCcnDVl EIormO6aW0dSM8UY4Wn1HhtahTKxVmzBcgjrdJ/cPcGwWtoWSYqCOZfYgZdQQD5BN0h7 44CxaF8Tftz1boBxvXn1ekWygtop6JKWnBnMfPdx7g5dyzymB3c7cz9LixCIeR7pFF2h wNPzgEZZ1hV49YXB/lpCxgT+ZIJALVDDVa94Sf2+IhMfQ9ueFP1YQ0awkIYHNdcFxuUl IoIMc+9U/vnFCh+XdGpl/o1NxDGe5ejajZKdd0VV3VDS7wRV2Ymv9xXAjbswfX8cVm/2 fUzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9YDOEAEyXkow7uR6OgwLWps/Y5sQ7ryLvO1+5xZjJa8=; b=v2Yx2CcpeCfnBkd5A1dhbtjX7uDGqpC2hGYVMkzBT2CN+YI7t8O4wG/0kXolJae7zY GOVkqvhhyDKApP4eVSDszKxWupNoT0GMEfw6R0x/mrNcHtzBJM5/HK9TM5srhzHrEXtS fUHXLjGghwHFWAZ1eRM436gfZYDansfz8ggqaQ4hnBTmRRr1KJkfHhakfupdPm9btLp9 IUd0BMmbZe6ht1exC/tDJXgXElJCA7SjJ1cmkbt2Ou38P5owYeaPdcjhBClrDxaASK0u 55tu2Ubkbd/thZCEQ0uTMDu9A7EH0K/UEjGVAO/QsCKf6qwLSgXvyfT/yFiaTDoIihDP af6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VY7p758g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du6-20020a17090772c600b00711dc674239si17196696ejc.726.2022.07.27.11.28.43; Wed, 27 Jul 2022 11:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VY7p758g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239879AbiG0Qow (ORCPT + 99 others); Wed, 27 Jul 2022 12:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235476AbiG0Qnt (ORCPT ); Wed, 27 Jul 2022 12:43:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE5A81C12C; Wed, 27 Jul 2022 09:30:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D45FAB821BE; Wed, 27 Jul 2022 16:30:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E5AC433C1; Wed, 27 Jul 2022 16:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939429; bh=exjTbktyQ2L4qT7er/q8xnaoToLGPnYfi4azjwuWwgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VY7p758gGcuC0bzJlPL+QbaMVE3akIZvepNOAJN9RXeXpDQHcXkVQBbE3bz4hERDm gHUbh4DqzR6tukVXrc+TpEvkRSrgUJjBAN2YyFfzFaNkkYhhYEYgjUSF9Cn/2sF/Tc UUc9jPAyz2rpxmYCy7M1aKx7LU89oOhk3mXTp7Ls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Ard Biesheuvel , Kees Cook , Hanjun Guo , Ard Biesheuvel , Elena Reshetova , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.4 66/87] locking/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions Date: Wed, 27 Jul 2022 18:10:59 +0200 Message-Id: <20220727161011.721547216@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon [ Upstream commit 65b008552469f1c37f5e06e0016924502e40b4f5 ] The definitions of REFCOUNT_MAX and REFCOUNT_SATURATED are the same, regardless of CONFIG_REFCOUNT_FULL, so consolidate them into a single pair of definitions. Signed-off-by: Will Deacon Reviewed-by: Ard Biesheuvel Reviewed-by: Kees Cook Tested-by: Hanjun Guo Cc: Ard Biesheuvel Cc: Elena Reshetova Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20191121115902.2551-8-will@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- include/linux/refcount.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/refcount.h b/include/linux/refcount.h index 1cd0a876a789..757d4630115c 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -22,6 +22,8 @@ typedef struct refcount_struct { } refcount_t; #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } +#define REFCOUNT_MAX INT_MAX +#define REFCOUNT_SATURATED (INT_MIN / 2) enum refcount_saturation_type { REFCOUNT_ADD_NOT_ZERO_OVF, @@ -57,9 +59,6 @@ static inline unsigned int refcount_read(const refcount_t *r) #ifdef CONFIG_REFCOUNT_FULL #include -#define REFCOUNT_MAX INT_MAX -#define REFCOUNT_SATURATED (INT_MIN / 2) - /* * Variant of atomic_t specialized for reference counts. * @@ -300,10 +299,6 @@ static inline void refcount_dec(refcount_t *r) refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); } #else /* CONFIG_REFCOUNT_FULL */ - -#define REFCOUNT_MAX INT_MAX -#define REFCOUNT_SATURATED (INT_MIN / 2) - # ifdef CONFIG_ARCH_HAS_REFCOUNT # include # else -- 2.35.1