Skip to contentSkip to conversation

ARM:net: an issue for k which is u32, never < 0

PATCH In review Chen Gang 4 participants 8 messages Mar 10, 2013 – Mar 12, 2013

Subsystems (3)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 ARM:net: an issue for k which is u32, never < 0

k is u32 which never < 0, need type cast, or cause issue.

---
 arch/arm/net/bpf_jit_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/net/bpf_jit_32.c +1 -1
index 6828ef6..a0bd8a7 100644
@@ -576,7 +576,7 @@ load_ind:
 			/* x = ((*(frame + k)) & 0xf) << 2; */
 			ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL;
 			/* the interpreter should deal with the negative K */
-			if (k < 0)
+			if ((int)k < 0)
 				return -1;
 			/* offset in r1: we might have to take the slow path */
 			emit_mov_i(r_off, k, ctx);
Signature · 1 line
1.7.7.6
author
#2 lore raw

? 2013?03?11? 05:12, David Miller ??:

Quoted 10 lines

From: Chen Gang <[email protected]>
Date: Sun, 10 Mar 2013 10:15:54 +0800

Quoted 4 lines
Quoted 4 lines

k is u32 which never < 0, need type cast, or cause issue.

Who will apply this, ARM folks or me?

sorry I don't know, either. I get the mail addresses by
./scripts/get_maintainers.pl. it includes you.

if no others reply within a week, I hope you can help to check and
apply it.

thanks.

Signature · 3 lines
Chen Gang

Asianux Corporation
author
#4 lore raw

? 2013?03?12? 00:47, Russell King - ARM Linux ??:

Quoted 7 lines · David Miller
Quoted 6 lines
Quoted 6 lines

From: Chen Gang <[email protected]>
Date: Sun, 10 Mar 2013 10:15:54 +0800

Quoted 3 lines
Quoted 3 lines

k is u32 which never < 0, need type cast, or cause issue.

Quoted 10 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Who will apply this, ARM folks or me?

I'm happy if you wish to take the patch:

Thanks.

thank you very much.

:-)

Signature · 3 lines
Chen Gang

Asianux Corporation
#5 lore raw
In reply to Russell King - ARM Linux

From: Russell King - ARM Linux <[email protected]>
Date: Mon, 11 Mar 2013 16:47:41 +0000

Quoted 7 lines · David Miller
Quoted 6 lines

From: Chen Gang <[email protected]>
Date: Sun, 10 Mar 2013 10:15:54 +0800

Quoted 3 lines

k is u32 which never < 0, need type cast, or cause issue.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Who will apply this, ARM folks or me?

I'm happy if you wish to take the patch:

Great, applied, thanks.

Acked-by on v1 1/1
#6 lore raw
In reply to Chen Gang

2013/3/10 Chen Gang <[email protected]>:

Quoted 22 lines

k is u32 which never < 0, need type cast, or cause issue.

---
 arch/arm/net/bpf_jit_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/net/bpf_jit_32.c +1 -2
index 6828ef6..a0bd8a7 100644
@@ -576,7 +576,7 @@ load_ind:
                        /* x = ((*(frame + k)) & 0xf) << 2; */
                        ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL;
                        /* the interpreter should deal with the negative K */
-                       if (k < 0)
+                       if ((int)k < 0)
                                return -1;
                        /* offset in r1: we might have to take the slow path */
                        emit_mov_i(r_off, k, ctx);
--
Quoted 1 line

1.7.7.6

author
#7 lore raw

? 2013?03?12? 00:54, Mircea Gherzan ??:

Quoted 9 lines

2013/3/10 Chen Gang <[email protected]>:

Quoted 8 lines
Quoted 8 lines

k is u32 which never < 0, need type cast, or cause issue.

---
 arch/arm/net/bpf_jit_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/net/bpf_jit_32.c +0 -0
index 6828ef6..a0bd8a7 100644
@@ -576,7 +576,7 @@ load_ind:
                        /* x = ((*(frame + k)) & 0xf) << 2; */
                        ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL;
Quoted 8 lines
Quoted 8 lines
arch/arm/net/bpf_jit_32.c +1 -2
                        /* the interpreter should deal with the negative K */
-                       if (k < 0)
+                       if ((int)k < 0)
                                return -1;
                        /* offset in r1: we might have to take the slow path */
                        emit_mov_i(r_off, k, ctx);
--

1.7.7.6

thank you very much.

:-)

Signature · 3 lines
Chen Gang

Asianux Corporation