From patchwork Thu May 21 19:44:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 27495 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id BDFA7B7063 for ; Fri, 22 May 2009 05:45:21 +1000 (EST) Received: by ozlabs.org (Postfix) id B22D2DE3FF; Fri, 22 May 2009 05:45:12 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id A9345DE3FE for ; Fri, 22 May 2009 05:45:12 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=jRRDuQUA6TJSOy8uxQHYnQlYcuti7FStArfnlxa2zBE=; b=rN7UcsKU0hNFJzPUqQo5deQ9UfycvlLrGRQ8ATkpl3pB8px3QiYpg80heyITUGy1nB Ara1r8r5RlKF1hQizuvN1JhlMwd4/Ew4czA9oz4K5n8tMu9j9TCTTQYrBTwpXYftUTsq /oP0ilV3kMxNrcrFJaZF1UC7fimuoQLN8fOFQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=N6OrnOEj6BqG/08koiT4k1yWfUbRrQ0yALv0T9ettuW3r7wLvXLCNSjiT3uP9xfoO3 QZGC4sOp5IsYdzkFpdq+gLGF1Tb7o49zFabrRzzoPeBw8+0qgXRYJBr1bdWU52PSb+tK TGK3MpkeqO9+h3JMpiOmP5td34nkUL2wnKags= Received: by 10.210.53.1 with SMTP id b1mr3633042eba.85.1242935091851; Thu, 21 May 2009 12:44:51 -0700 (PDT) Received: from ?192.168.1.2? (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 23sm179132eya.39.2009.05.21.12.44.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); 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 User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: paulmck@linux.vnet.ibm.com Subject: [PATCH] powerpc:beyond ARRAY_SIZE of args.args Cc: linuxppc-dev@ozlabs.org, Andrew Morton X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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;