Received: by 10.213.65.68 with SMTP id h4csp904227imn; Tue, 27 Mar 2018 10:55:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lgXaiE5tlxv5jIA4C+hZxJVg+lZh+q2DIFYTbYMNs8WaUzK26krTePXC3nsgYRVM+DKMQ X-Received: by 10.101.70.203 with SMTP id n11mr209615pgr.166.1522173312164; Tue, 27 Mar 2018 10:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173312; cv=none; d=google.com; s=arc-20160816; b=E9toRb335A9OnIiNEWg9MR3DX5baGVtpUlnVwHKEZ1aHwV42ZMa/v8LfwncH5l0AzQ sLCoEVg5KFwaNK3TX2j5b5Gql0L5FBhxYp1wFof4DJhIBSMqNEniQQ0aIeALkI8LiFwc McKDDaMAn58xTQOmdjjqAfQAhNQhPd9721LNBm65GMLQrJGsHNGpxC55i8y531yShjrz y+3H5aP5dc/l1gEWMA7Dg6J5L+K8aSnOKE5Czu9poCT4YEudcG+tCM2xXL7QbnlnF9MB aKpHqjZJsuua4+Rd/SfVQJeqj/PiwiN2q5vT78YzE/znN1WFX8iLzijdlv69z4FmvHDH 03BA== 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=9mEkEiaV2qTc/fKWMi7ZSTexxVjr5i73DLsdzz8JIxA=; b=LcK2F6ffXSuuvZZ2YwJsyJgIYjJ7Hp9IaMB6nagIvHCgXwPW/tqsIUcnvJGlv3y6dd SmqCUL06xXUx1aLEg7Y88VfKptBTeeiMUAUz1pfRbBu4FhXfb2XBPQODe4bbeWMto1fy C8PBwtdiwAvh2k9EYzy55MHw604c+02jsKyLV3s+unBWu/kGQapN6z+pc5YhYp6A3EC3 KtcdkMv1VAJjxwnF1PeBab6aW3IS5mLqOn8O75NjBsGI34qSwFfHfIdMRpNh6eoM9STM DyW2MIB0CNw+xUtTJy6KXxo6s6enxzHnZLP5k6D7KPHewLCOj4tcpuUzoEjpWs64aaEZ 5r2g== 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 r15-v6si1743842plj.96.2018.03.27.10.54.57; Tue, 27 Mar 2018 10:55:12 -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 S1753648AbeC0RxF (ORCPT + 99 others); Tue, 27 Mar 2018 13:53:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753507AbeC0QcE (ORCPT ); Tue, 27 Mar 2018 12:32:04 -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 1BFD9EB8; Tue, 27 Mar 2018 16:32:03 +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.9 38/67] mtdchar: fix usage of mtd_ooblayout_ecc() Date: Tue, 27 Mar 2018 18:27:30 +0200 Message-Id: <20180327162729.101835615@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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;