All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code
@ 2022-03-16 12:51 Zhen Lei
  2022-04-04  9:31 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2022-03-16 12:51 UTC (permalink / raw)
  To: Andrew Morton, Will Deacon, Ingo Molnar, linux-kernel; +Cc: Zhen Lei

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;
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code
  2022-03-16 12:51 [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code Zhen Lei
@ 2022-04-04  9:31 ` Will Deacon
  2022-11-02  9:41   ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2022-04-04  9:31 UTC (permalink / raw)
  To: Zhen Lei; +Cc: Andrew Morton, Ingo Molnar, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code
  2022-04-04  9:31 ` Will Deacon
@ 2022-11-02  9:41   ` Leizhen (ThunderTown)
  0 siblings, 0 replies; 3+ messages in thread
From: Leizhen (ThunderTown) @ 2022-11-02  9:41 UTC (permalink / raw)
  To: Will Deacon; +Cc: Andrew Morton, Ingo Molnar, linux-kernel



On 2022/4/4 17:31, Will Deacon wrote:
> 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>

Can anyone pick up this patch? It seems to have been forgotten.

> 
> Will
> .
> 

-- 
Regards,
  Zhen Lei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-02  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 12:51 [PATCH] locking/refcount: Use REFCOUNT_WARN() to simplify code Zhen Lei
2022-04-04  9:31 ` Will Deacon
2022-11-02  9:41   ` Leizhen (ThunderTown)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.