Received: by 10.213.65.68 with SMTP id h4csp852175imn; Tue, 27 Mar 2018 09:58:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/c5y2fQJv7RuszzZOxi6Q84L2w3/dYcJoFOBCVRBjusy1dhMCC9v395tCBmyEBBWwbPn+S X-Received: by 10.98.217.85 with SMTP id s82mr95425pfg.208.1522169913137; Tue, 27 Mar 2018 09:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169913; cv=none; d=google.com; s=arc-20160816; b=pgathqUMULzdJBH7Ut4tYExgl6scVH/YeCFVF6HtJe7gmEh1JNIn1sAmx5ekoIaNMD 99NYcJr7GQ+am26UcSaa/qka1G9rhWSCPkU7N6ru+wNmzKE2fuQqn6C8Vc1T3+gB6h5Q /GnDZlFZxe1QfIDQ33HTlV7piXI9J/y3sWao/99PVndKooO5Qj6ZKvuwpbMMWO530b1C ew2wUgzFj5tBB9CLk0WRsz52kClbHBxP4gss/jvE+WIWxg+DRJcZRxeF96J6XZTCqLQh FaeDtxJWlmvXBhr7QMRJ5EJDKDK12uzo74IG3VFSzOQ2IuaT+oj/ggTWgXarjGzOxd7u 2rBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=5bfJzpgMDJemkyco9b8GyBdrzwwhG2SUQNKW2NjFP4Q=; b=wBivFax0uRnoddXFMLBU/rZkQniDm1ktOIrtcY+jOH+cHAdtLo8ifYqqD3XGz1hfHx qbGxTc7ZqvkOqJsLV66y3fWympbqLSIeIE4Az+LfJ/uz85bKFgxEJ8Ujd1r1CyZ4W8Ip TxGZwzIjHxD9Lj7nKKrq9a2/7rdttVTqHeXdBtdtfJmjUqbRoH2A8a0JHtx/gvdqj8oo aW9pHteLgNUc2rF5lWoPAlewZlCtvqtRDFMM43hnZT6GPIom2GdGTRHFKA7oUomaASwg vUaVyLuL6E67wo0el9o17JQPgko4a+h6p5URn9gONryx9AX/bz8L144UBG8p033ps5Eh hi3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11-v6si1532748plt.266.2018.03.27.09.58.18; Tue, 27 Mar 2018 09:58:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753263AbeC0Q5D (ORCPT + 99 others); Tue, 27 Mar 2018 12:57:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48768 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752701AbeC0Qlh (ORCPT ); Tue, 27 Mar 2018 12:41:37 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 65EA1F3F; Tue, 27 Mar 2018 16:41:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, OuYang ZhiZhong , Boris Brezillon Subject: [PATCH 4.15 070/105] mtdchar: fix usage of mtd_ooblayout_ecc() Date: Tue, 27 Mar 2018 18:27:50 +0200 Message-Id: <20180327162802.278281258@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: OuYang ZhiZhong commit 6de564939e14327148e31ddcf769e34105176447 upstream. Section was not properly computed. The value of OOB region definition is always ECC section 0 information in the OOB area, but we want to get all the ECC bytes information, so we should call mtd_ooblayout_ecc(mtd, section++, &oobregion) until it returns -ERANGE. Fixes: c2b78452a9db ("mtd: use mtd_ooblayout_xxx() helpers where appropriate") Cc: Signed-off-by: OuYang ZhiZhong Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/mtdchar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -479,7 +479,7 @@ static int shrink_ecclayout(struct mtd_i for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES;) { u32 eccpos; - ret = mtd_ooblayout_ecc(mtd, section, &oobregion); + ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); if (ret < 0) { if (ret != -ERANGE) return ret; @@ -526,7 +526,7 @@ static int get_oobinfo(struct mtd_info * for (i = 0; i < ARRAY_SIZE(to->eccpos);) { u32 eccpos; - ret = mtd_ooblayout_ecc(mtd, section, &oobregion); + ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); if (ret < 0) { if (ret != -ERANGE) return ret;