2010-01-08 19:02:28

by Roel Kluin

[permalink] [raw]
Subject: [PATCH] Blackfin arch: Fix decoding of opcodes 41-47 in decode_instruction()

This condition allowed only decoding of opcode 0x0040

Signed-off-by: Roel Kluin <[email protected]>
---
arch/blackfin/kernel/traps.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

Found with static code analysis. Correct?

diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index d3cbcd6..870d74b 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -712,7 +712,7 @@ static void decode_instruction(unsigned short *address)
verbose_printk("RTE");
else if (opcode == 0x0025)
verbose_printk("EMUEXCPT");
- else if (opcode == 0x0040 && opcode <= 0x0047)
+ else if (opcode >= 0x0040 && opcode <= 0x0047)
verbose_printk("STI R%i", opcode & 7);
else if (opcode >= 0x0050 && opcode <= 0x0057)
verbose_printk("JUMP (P%i)", opcode & 7);


2010-01-09 07:14:10

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH] Blackfin arch: Fix decoding of opcodes 41-47 in decode_instruction()

On Fri, Jan 8, 2010 at 14:06, Roel Kluin wrote:
> This condition allowed only decoding of opcode 0x0040
>
> Signed-off-by: Roel Kluin <[email protected]>
> ---
>  arch/blackfin/kernel/traps.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> Found with static code analysis. Correct?

looks like it to me:
0: 40 00 STI R0;
2: 41 00 STI R1;
4: 42 00 STI R2;
6: 43 00 STI R3;
8: 44 00 STI R4;
a: 45 00 STI R5;
c: 46 00 STI R6;
e: 47 00 STI R7;

ive added this to the Blackfin repo, thanks
-mike