From patchwork Thu Mar 5 12:11:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 24097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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 ozlabs.org (Postfix) with ESMTPS id EE2C7DDE0E for ; Thu, 5 Mar 2009 23:14:20 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LfCRZ-0000P2-56; Thu, 05 Mar 2009 12:12:53 +0000 Received: from mail-ew0-f172.google.com ([209.85.219.172]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LfCQB-0000OW-Uk for linux-mtd@lists.infradead.org; Thu, 05 Mar 2009 12:11:30 +0000 Received: by ewy20 with SMTP id 20so3354247ewy.18 for ; Thu, 05 Mar 2009 04:11:26 -0800 (PST) Received: by 10.216.52.204 with SMTP id e54mr591506wec.171.1236255086501; Thu, 05 Mar 2009 04:11:26 -0800 (PST) Received: from ?192.168.1.115? (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 5sm52470eyh.31.2009.03.05.04.11.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 05 Mar 2009 04:11:25 -0800 (PST) Message-ID: <49AFC16E.5090904@gmail.com> Date: Thu, 05 Mar 2009 13:11:26 +0100 From: Roel Kluin User-Agent: Thunderbird 2.0.0.18 (X11/20081105) MIME-Version: 1.0 To: dwmw2@infradead.org Subject: [PATCH] maps: test before subtraction on unsigned long intel1size X-Spam-Score: 0.0 (/) Cc: Andrew Morton , "linux-mtd@lists.infradead.org" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 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 I found this by code inspection, I could be wrong, but isn't a test required before this subtraction? note that intel1size is unsigned long. Also I noted that the file makes extensive use of volatile. is that necessary? ------------------------------>8-------------8<--------------------------------- Test before subtraction on unsigned long intel1size. Signed-off-by: Roel Kluin diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index a97133e..ed2fc83 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c @@ -349,11 +349,12 @@ static int __init nettel_init(void) goto out_unmap1; } - intel1size = intel_mtd->size - intel0size; - if (intel1size > 0) { + if (intel_mtd->size > intel0size) { + intel1size = intel_mtd->size - intel0size; *intel1par = SC520_PAR(intel1cs, intel1addr, intel1size); __asm__ ("wbinvd"); } else { + intel1size = 0; *intel1par = 0; }