Received: by 10.213.65.68 with SMTP id h4csp835580imn; Tue, 27 Mar 2018 09:39:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/s4BzGZE5gmyTYtjd/6I2Fq6RKkMBArlFm4R1RpRnPStVwUccMg8hXuNGoEB/OvTt6pCHL X-Received: by 10.98.224.93 with SMTP id f90mr44632pfh.21.1522168769140; Tue, 27 Mar 2018 09:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522168769; cv=none; d=google.com; s=arc-20160816; b=MtodX127fTWh3PSpuE/PikyxU+a0emq2YXOBpnSYvUoRoHyKuODFIokvtzfmxkydCR OZ/+nBHW8rSW0yeMFO/6HGjs6mtB51+dT+aHI9lmHzZabCd1S4gSowvv6OwKYpVoLqar 56xBtJO52XbdEHDEekv2ZJYs7ZvSgxJ24iEVKzxMtmTFwZ/Lwkh7htRhUxWUZil/U6I1 xiyOk1BHTNcYKIwAelVFxHMnOqAgkyOdvaTUoStEmVKRL7o5e1ajdm4C2AobL+Wz4Lc9 ZOx8p0KogMP0ZuTxzesGG1EqSbbJBiiyEIqaMFNh64cET9LYdalE12Lk5uWDGKj0X8Tc GPzg== 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=fb03iGY2U5Fgpi/WuDK05Xed4CtUo1RGjZ0tDuwz15U=; b=XxmpqtYoGMDUG3bvU5IPgxIjak50GrCqybdGaVJLVXVsjRyuBUbDCg94wAsyAyvdjN cC69eR1jvc7p/T+10pwK8aCoQXFlAXUJQ44LBzbU81W4Yr7wvYglyNEedHOh52PAHGiU d/R+Qa+u7yrLMT6BCIGcTQBBScB/ajcxr9A1ulWz6nHXl0Hv9Y6QQIYCM1n+CN8C97lA DF7Sk60SIakI7inifkjdkUMVRtqCSIUnl/bO2ATd9J25UsOkNtXXGEHbZW7riwzK4Fq1 /oR9FTJ7YBScHWkILamF2cN7/yU0LOInAjaaFaP6apgafg9+/CGTkQEoze2sFLEEKS8d fzGw== 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 v8-v6si1560641plk.659.2018.03.27.09.39.14; Tue, 27 Mar 2018 09:39:29 -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 S1755170AbeC0QiQ (ORCPT + 99 others); Tue, 27 Mar 2018 12:38:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46656 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755140AbeC0QiN (ORCPT ); Tue, 27 Mar 2018 12:38:13 -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 925C51005; Tue, 27 Mar 2018 16:38:12 +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.14 065/101] mtdchar: fix usage of mtd_ooblayout_ecc() Date: Tue, 27 Mar 2018 18:27:37 +0200 Message-Id: <20180327162754.010738067@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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 @@ -487,7 +487,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; @@ -534,7 +534,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;