[PATCH] powerpc:beyond ARRAY_SIZE of args.args

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE6314d

2 messages, 2 authors, 2009-05-21 · open the first message on its own page

[PATCH] powerpc:beyond ARRAY_SIZE of args.args

From: Roel Kluin <hidden>
Date: 2009-05-21 19:44:53

Do not go beyond ARRAY_SIZE of args.args

Signed-off-by: Roel Kluin <redacted>
---
I'm quite sure the first is correct, but should maybe `args.nret'
and `nargs + args.nret' also be `>= ARRAY_SIZE(args.args)'?
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 1f8505c..c94ab76 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -779,7 +779,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
 		return -EFAULT;
 
 	nargs = args.nargs;
-	if (nargs > ARRAY_SIZE(args.args)
+	if (nargs >= ARRAY_SIZE(args.args)
 	    || args.nret > ARRAY_SIZE(args.args)
 	    || nargs + args.nret > ARRAY_SIZE(args.args))
 		return -EINVAL;

Re: [PATCH] powerpc:beyond ARRAY_SIZE of args.args

From: Paul Mackerras <hidden>
Date: 2009-05-21 23:10:44

Roel Kluin writes:
Do not go beyond ARRAY_SIZE of args.args

Signed-off-by: Roel Kluin <redacted>
---
I'm quite sure the first is correct, but should maybe `args.nret'
and `nargs + args.nret' also be `>= ARRAY_SIZE(args.args)'?
I don't think this change is needed, and it changes a user-visible
API, so I'm nacking it unless you can convince me there's really a
problem.

If nargs == ARRAY_SIZE(args.args), then args.nret must be zero, so
nothing will access *(args.rets).

Paul.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help