Skip to contentSkip to conversation

powerpc:beyond ARRAY_SIZE of args.args

PATCH In review Roel Kluin 2 participants 2 messages May 21, 2009 PowerPC

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 powerpc:beyond ARRAY_SIZE of args.args

Do not go beyond ARRAY_SIZE of args.args

---
I'm quite sure the first is correct, but should maybe args.nret' and nargs + args.nret' also be `>= ARRAY_SIZE(args.args)'?

arch/powerpc/kernel/rtas.c +1 -1
index 1f8505c..c94ab76 100644
@@ -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;
#1 lore raw
Quoted 6 lines · Roel Kluin

Do not go beyond ARRAY_SIZE of args.args

---
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.