mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code
Date: Mon, 4 Apr 2022 10:31:04 +0100	[thread overview]
Message-ID: <20220404093103.GA22875@willie-the-truck> (raw)
In-Reply-To: <20220316125114.1177-1-thunder.leizhen@huawei.com>

On Wed, Mar 16, 2022 at 08:51:14PM +0800, Zhen Lei wrote:
> To avoid the check "new > val" appears twice, and make the style
> consistent with that in refcount_warn_saturate().
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  lib/refcount.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/refcount.c b/lib/refcount.c
> index a207a8f22b3ca35..d36aa3fa728f53b 100644
> --- a/lib/refcount.c
> +++ b/lib/refcount.c
> @@ -84,7 +84,7 @@ bool refcount_dec_not_one(refcount_t *r)
>  
>  		new = val - 1;
>  		if (new > val) {
> -			WARN_ONCE(new > val, "refcount_t: underflow; use-after-free.\n");
> +			REFCOUNT_WARN("underflow; use-after-free");
>  			return true;
>  		}

Acked-by: Will Deacon <will@kernel.org>

Will

  reply	other threads:[~2022-04-04  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 12:51 Zhen Lei
2022-04-04  9:31 ` Will Deacon [this message]
2022-11-02  9:41   ` Leizhen (ThunderTown)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220404093103.GA22875@willie-the-truck \
    --to=will@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=thunder.leizhen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®