From patchwork Sun Aug 2 08:02:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 38708 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n727xLle000303 for ; Sun, 2 Aug 2009 07:59:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752185AbZHBH7T (ORCPT ); Sun, 2 Aug 2009 03:59:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752208AbZHBH7T (ORCPT ); Sun, 2 Aug 2009 03:59:19 -0400 Received: from mail-ew0-f214.google.com ([209.85.219.214]:56558 "EHLO mail-ew0-f214.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbZHBH7S (ORCPT ); Sun, 2 Aug 2009 03:59:18 -0400 Received: by ewy10 with SMTP id 10so2377088ewy.37 for ; Sun, 02 Aug 2009 00:59:18 -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:subject:content-type :content-transfer-encoding; bh=VKn4yVTpPkDIBbDJgpiuNKvbYdmX5KpZeaTT8BZzhUI=; b=aEGtLkiBQtqdk3DHNfGMpDNLEkQY1NAP/wq8mjvVrhEe/KnFibUFpj4p0pufFYIKtw V52YT/PNpj6MJHFrBIZFLb8pmskxrpTfwVDi9x88I0YS6KKYPzNKKMCCk7w/Y3/b0X2w og5/zE2Dac6yYeBDdRvLl5NHoxVgsll9hvIws= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=lggWTJYko9DZP9AJwFwfnKFStAoDAq1qcgtF5Y9kf5SqOZ9/agoyZHcyUBoiQ9SkZo nQC0kkhZUCE5x+cuy8KFVJshiX0l5n570LgNLtmvCUzHo/hfBeM3fvAS8nrgvq9z0jyM M5JMCjrkbcn+0Iwc2979hszPvPvUBpTLFqqlo= Received: by 10.211.180.15 with SMTP id h15mr5457994ebp.40.1249199958581; Sun, 02 Aug 2009 00:59:18 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm8653705eyg.40.2009.08.02.00.59.17 (version=SSLv3 cipher=RC4-MD5); Sun, 02 Aug 2009 00:59:18 -0700 (PDT) Message-ID: <4A754814.50506@gmail.com> Date: Sun, 02 Aug 2009 10:02:28 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: kyle@mcmartin.ca, deller@gmx.de, linux-parisc@vger.kernel.org, Andrew Morton Subject: [PATCH] kobject: Read buffer overflow Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin --- This also removes the likely, should it be kept? -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index f9f9a5f..13a64bc 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -370,7 +370,7 @@ pdcspath_layer_read(struct pdcspath_entry *entry, char *buf) if (!i) /* entry is not ready */ return -ENODATA; - for (i = 0; devpath->layers[i] && (likely(i < 6)); i++) + for (i = 0; i < 6 && devpath->layers[i]; i++) out += sprintf(out, "%u ", devpath->layers[i]); out += sprintf(out, "\n");