Skip to contentSkip to conversation

LoongArch: Fix unsigned comparison with less than zero

PATCH Applied [email protected] 2 participants 2 messages Nov 6, 2022 LoongArch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LoongArch: Fix unsigned comparison with less than zero

Eliminate the following coccicheck warning:

./arch/loongarch/kernel/unwind_prologue.c:84:5-13: WARNING: Unsigned expression compared with zero: frame_ra < 0

---
 arch/loongarch/kernel/unwind_prologue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/loongarch/kernel/unwind_prologue.c +2 -1
index b206d9159205..58ccdbe7fa22 100644
@@ -43,7 +43,8 @@ static bool unwind_by_prologue(struct unwind_state *state)
 {
 	struct stack_info *info = &state->stack_info;
 	union loongarch_instruction *ip, *ip_end;
-	unsigned long frame_size = 0, frame_ra = -1;
+	unsigned long frame_size = 0;
+	long frame_ra = -1;
 	unsigned long size, offset, pc = state->pc;
 
 	if (state->sp >= info->end || state->sp < info->begin)
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw

Queued for loongarch-fixes, thanks.

Huacai

Quoted 27 lines · On Sun, Nov 6, 2022 at 6:32 PM <[email protected]> wrote:

Eliminate the following coccicheck warning:

./arch/loongarch/kernel/unwind_prologue.c:84:5-13: WARNING: Unsigned expression compared with zero: frame_ra < 0

---
 arch/loongarch/kernel/unwind_prologue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/loongarch/kernel/unwind_prologue.c +2 -2
index b206d9159205..58ccdbe7fa22 100644
@@ -43,7 +43,8 @@ static bool unwind_by_prologue(struct unwind_state *state)
 {
        struct stack_info *info = &state->stack_info;
        union loongarch_instruction *ip, *ip_end;
-       unsigned long frame_size = 0, frame_ra = -1;
+       unsigned long frame_size = 0;
+       long frame_ra = -1;
        unsigned long size, offset, pc = state->pc;
 
        if (state->sp >= info->end || state->sp < info->begin)
--

2.25.1