From patchwork Sun Apr 3 16:23:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 89532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6426FB6F7B for ; Mon, 4 Apr 2011 02:24:10 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40A5128099; Sun, 3 Apr 2011 18:24:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1YmpCZLzcd6Z; Sun, 3 Apr 2011 18:24:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 326F128091; Sun, 3 Apr 2011 18:24:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DEC628091 for ; Sun, 3 Apr 2011 18:24:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A7r5kWGLoQHL for ; Sun, 3 Apr 2011 18:24:00 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ww0-f52.google.com (mail-ww0-f52.google.com [74.125.82.52]) by theia.denx.de (Postfix) with ESMTPS id 066AC2808F for ; Sun, 3 Apr 2011 18:23:58 +0200 (CEST) Received: by wwe15 with SMTP id 15so6932500wwe.9 for ; Sun, 03 Apr 2011 09:23:56 -0700 (PDT) Received: by 10.216.161.205 with SMTP id w55mr1547181wek.104.1301847836089; Sun, 03 Apr 2011 09:23:56 -0700 (PDT) Received: from bender.localnet (fbx.mimichou.net [82.236.225.16]) by mx.google.com with ESMTPS id r57sm1877012wes.1.2011.04.03.09.23.54 (version=SSLv3 cipher=OTHER); Sun, 03 Apr 2011 09:23:55 -0700 (PDT) From: Florian Fainelli To: Scott Wood , u-boot@lists.denx.de Date: Sun, 3 Apr 2011 18:23:52 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.5.1; x86_64; ; ) Organization: OpenWrt MIME-Version: 1.0 Message-Id: <201104031823.53020.florian@openwrt.org> Subject: [U-Boot] [PATCH 1/2] NAND: Fix integer overflow in ONFI detection of chips >= 4GiB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Florian Fainelli This patch sync with David's patch on Linux in nand_flash_detect_onfi() commit 4ccb3b4497ce01fab4933704fe21581e30fda1a5 Author: David Woodhouse Date: Fri Dec 3 16:36:34 2010 +0000 mtd: nand: Fix integer overflow in ONFI detection of chips >= 4GiB Signed-off-by: David Woodhouse Signed-off-by: Florian Fainelli diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index fa286a8..3cb92c1 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2482,7 +2482,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, mtd->writesize = le32_to_cpu(p->byte_per_page); mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); - chip->chipsize = le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; + chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; *busw = 0; if (le16_to_cpu(p->features) & 1) *busw = NAND_BUSWIDTH_16;