lib/stackdepot : Remove logically dead code in stack_depot_init()
PATCH 1/1 lib/stackdepot : Remove logically dead code in stack_depot_init()
Since scale is always greater than PAGE_SHIFT, remove the unreachable else branch and simplify the conditional shift.
This issue was reported by Coverity scan.
Signed-off-by Chelsy Ratnawat <[email protected]>
--- lib/stackdepot.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/stackdepot.c +1 -5
@@ -247,11 +247,7 @@ int stack_depot_init(void) entries =nr_free_buffer_pages (); entries =roundup_pow_of_two (entries); - -if (scale >PAGE_SHIFT ) - entries >>= (scale -PAGE_SHIFT ); -else - entries <<= (PAGE_SHIFT - scale); + entries >>= (scale -PAGE_SHIFT ); }if (entries <1UL <<STACK_BUCKET_NUMBER_ORDER_MIN )
Signature · 1 line
2.53.0
Marco Elver
NAKQuoted 3 lines · Chelsy Ratnawat
Since scale is always greater than
PAGE_SHIFT, remove the unreachable else branch and simplify the conditional shift.
Is it on all architectures?
Sashiko noticed this as well:
https://sashiko.dev/#/patchset/20261016062011.103059-1-chelsyratnawat2001%40gmail.com
NACK.
Quoted 27 lines
This issue was reported by Coverity scan.
Signed-off-by Chelsy Ratnawat <[email protected]>--- lib/stackdepot.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)lib/stackdepot.c +1
-6@@ -247,11 +247,7 @@ int stack_depot_init(void) entries =nr_free_buffer_pages (); entries =roundup_pow_of_two (entries); - -if (scale >PAGE_SHIFT ) - entries >>= (scale -PAGE_SHIFT ); -else - entries <<= (PAGE_SHIFT - scale); + entries >>= (scale -PAGE_SHIFT ); }if (entries <1UL <<STACK_BUCKET_NUMBER_ORDER_MIN ) --2.53.0