From patchwork Fri Jul 31 12:47:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 30428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 28237B7BAF for ; Fri, 31 Jul 2009 22:47:43 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWrTt-0003fZ-8B; Fri, 31 Jul 2009 12:45:05 +0000 Received: from ey-out-1920.google.com ([74.125.78.144]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWrTm-0003CK-Ld for linux-mtd@lists.infradead.org; Fri, 31 Jul 2009 12:45:03 +0000 Received: by ey-out-1920.google.com with SMTP id 5so520550eyb.24 for ; Fri, 31 Jul 2009 05:44:55 -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=UmWV2Op67nIeOg3jNjFb4S/H73XZ9zY9csldwrseLKE=; b=fmwXUEWz6/KK+pi6pjVScGfmgmGXDubqhWM8+jSRXIY+e3ai1kNfc46idMdcoKGBGx Bec/7+yYwbPnxXqVNYRyWbGNsUQbpWslcBNy6Tj+M22W8BhgrHcYQ44tKLqreWtP3e7n yRzKmT0ASch9mxf538gqu3dpccNv7q8qapRbQ= 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=AzmbVfcMF389ZwnBe/DgVdg4q/0c9ZK1R+fZBrvzA0nCIsz9gQAdojcKA/90HFVkld LhNyhUpgE8DdM3By1ooRrHUUiFiDYgIN0pDO1WhBOR2CmpPu73p5rB2cS9ufYHw9ReXI eab7z5caq/rTelkMXxMtjx7WgP8Z4SO7xcJ7Y= Received: by 10.210.58.5 with SMTP id g5mr852292eba.37.1249044295445; Fri, 31 Jul 2009 05:44:55 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm3293493eyb.27.2009.07.31.05.44.54 (version=SSLv3 cipher=RC4-MD5); Fri, 31 Jul 2009 05:44:55 -0700 (PDT) Message-ID: <4A72E7FE.6000207@gmail.com> Date: Fri, 31 Jul 2009 14:47:58 +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: dwmw2@infradead.org, linux-mtd@lists.infradead.org, Andrew Morton Subject: [PATCH] slram: Read buffer overflow X-Spam-Score: 0.0 (/) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org map[count] is checked before count < SLRAM_MAX_DEVICES_PARAMS Signed-off-by: Roel Kluin --- declared on drivers/mtd/devices/slram.c:66: static char *map[SLRAM_MAX_DEVICES_PARAMS]; diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index 00248e8..239500b 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c @@ -341,7 +341,7 @@ static int init_slram(void) #else int count; - for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS); + for (count = 0; count < SLRAM_MAX_DEVICES_PARAMS && map[count]; count++) { }