Message ID | 1415206793-25670-7-git-send-email-lee.jones@linaro.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBDA7X7F2WUEBBQNP5GRAKGQEAXH4EZQ@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 12DEA240A6 for <linaro@patches.linaro.org>; Wed, 5 Nov 2014 17:00:52 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf1133920eek.2 for <linaro@patches.linaro.org>; Wed, 05 Nov 2014 09:00:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=bgKuqCTp7ul/KaXXUZcx3Ae2A1V4vFV/KADeGr+kUeU=; b=FWIg/wiHQK5WVtNdlgPKrbWdZahCtDHyrzQQ6EQEpCrfMDhq7U5wuXpqRJOFd84bzX UkLxOdxP7hdohUrwBRai/5rnbHemeCK6sWAELZYAd64qBZDMI1TYSST7Hdsseq8aN4ZH koojWTSOcvs1U0QiHx2J0LEWye00EiWb9jeK1Y90cBMKWKMTv79XJDrV8iwrCDEpYvLX CKXVdUWqpKnWf9JR/dZ7dvyKOohwlbsIM/25feqMSlGsFiXQCPs8z+lfHtimEOYSH5Op un68NOome27aaY/VPhl8tJgl518lkmzjoFL4Y5nfA7vDraflbNfhVwAZZFxyZuxFOXh3 dfMw== X-Gm-Message-State: ALoCoQlM04hXKpOVafQfqEhTwiEM0hiM1bA4Mgx39MjeGUd4ZlZ05iwfLZY/j5YGEBUuqvjk01Kn X-Received: by 10.152.3.168 with SMTP id d8mr10051185lad.0.1415206849065; Wed, 05 Nov 2014 09:00:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.39 with SMTP id b7ls917273lae.38.gmail; Wed, 05 Nov 2014 09:00:48 -0800 (PST) X-Received: by 10.112.150.41 with SMTP id uf9mr5412939lbb.100.1415206848867; Wed, 05 Nov 2014 09:00:48 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id lb6si7054662lac.111.2014.11.05.09.00.48 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 09:00:48 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so1036291lam.41 for <patchwork-forward@linaro.org>; Wed, 05 Nov 2014 09:00:48 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr68754565lbc.23.1415206848532; Wed, 05 Nov 2014 09:00:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp315896lbc; Wed, 5 Nov 2014 09:00:47 -0800 (PST) X-Received: by 10.70.60.198 with SMTP id j6mr1104132pdr.94.1415206845529; Wed, 05 Nov 2014 09:00:45 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si3384965pdl.249.2014.11.05.09.00.44 for <multiple recipients>; Wed, 05 Nov 2014 09:00:45 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932110AbaKERAk (ORCPT <rfc822;hongbo.zhang@linaro.org> + 25 others); Wed, 5 Nov 2014 12:00:40 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:57190 "EHLO mail-ie0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754729AbaKERAe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Nov 2014 12:00:34 -0500 Received: by mail-ie0-f173.google.com with SMTP id tr6so1107186ieb.32 for <linux-kernel@vger.kernel.org>; Wed, 05 Nov 2014 09:00:34 -0800 (PST) X-Received: by 10.50.3.36 with SMTP id 4mr33328030igz.20.1415206834299; Wed, 05 Nov 2014 09:00:34 -0800 (PST) Received: from localhost.localdomain (host86-129-140-59.range86-129.btcentralplus.com. [86.129.140.59]) by mx.google.com with ESMTPSA id rj6sm6663489igc.0.2014.11.05.09.00.32 for <multiple recipients> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Nov 2014 09:00:33 -0800 (PST) From: Lee Jones <lee.jones@linaro.org> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, computersforpeace@gmail.com, pekon@pek-sem.com, linux-mtd@lists.infradead.org Subject: [PATCH v4 06/11] mtd: nand: WARN() if EEC Bytes per page is larger than the OOB Date: Wed, 5 Nov 2014 16:59:48 +0000 Message-Id: <1415206793-25670-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415206793-25670-1-git-send-email-lee.jones@linaro.org> References: <1415206793-25670-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 4f3e80c..d0ebb05 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4063,6 +4063,8 @@ int nand_scan_tail(struct mtd_info *mtd) } ecc->total = ecc->steps * ecc->bytes; + WARN_ON(ecc->total > mtd->oobsize); + /* Allow subpage writes up to ecc.steps. Not possible for MLC flash */ if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) { switch (ecc->steps) {
EEC information is held in the Out-Of-Bounds (OOB) area, so can not be larger than the area it's stored in. If the math is out, we issue a warning to the user. Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/mtd/nand/nand_base.c | 2 ++ 1 file changed, 2 insertions(+)