From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ew0-f167.google.com (mail-ew0-f167.google.com [209.85.219.167]) by ozlabs.org (Postfix) with ESMTP id EEBEADE1CD for ; Fri, 22 May 2009 05:44:53 +1000 (EST) Received: by ewy11 with SMTP id 11so1469781ewy.9 for ; Thu, 21 May 2009 12:44:51 -0700 (PDT) Message-ID: <4A15AF33.60100@gmail.com> Date: Thu, 21 May 2009 21:44:51 +0200 From: Roel Kluin MIME-Version: 1.0 To: paulmck@linux.vnet.ibm.com Subject: [PATCH] powerpc:beyond ARRAY_SIZE of args.args Content-Type: text/plain; charset=ISO-8859-1 Cc: linuxppc-dev@ozlabs.org, Andrew Morton List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Do not go beyond ARRAY_SIZE of args.args Signed-off-by: Roel Kluin --- 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;