locking/refcount: Use REFCOUNT_WARN() to simplify code
PATCH 1/1 locking/refcount: Use REFCOUNT_WARN() to simplify code
To avoid the check "new > val" appears twice, and make the style consistent with that in refcount_warn_saturate().
Signed-off-by Zhen Lei <[email protected]>
--- lib/refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/refcount.c +1 -1
@@ -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; }
Signature · 1 line
2.25.1
Quoted 13 lines · 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 <[email protected]>--- lib/refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/refcount.c +0
-0
lib/refcount.c bool refcount_dec_not_one(refcount_t *r) · line 89
Quoted 7 lines
lib/refcount.c +1
-1@@ -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 <[email protected]>
Will
Quoted 15 lines · Will Deacon
Quoted 14 lines · 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 <[email protected]>--- lib/refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/refcount.c +0
-0@@ -84,7 +84,7 @@ bool refcount_dec_not_one(refcount_t *r)
Quoted 8 lines
lib/refcount.c bool refcount_dec_not_one(refcount_t *r) · line 89
Quoted 6 lines
lib/refcount.c +1
-1new = 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 <[email protected]>
Can anyone pick up this patch? It seems to have been forgotten.
Quoted 4 lines
Will
.
Signature · 2 lines
Regards, Zhen Lei