Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4019830pxu; Mon, 21 Dec 2020 02:03:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJylztcmxOpwlTFvv7Hz9J5DcjnSDLECHamtifhB2ScoQ79wG4Ogkfqrc1MEm+1/YaiIHBmd X-Received: by 2002:a17:906:e24f:: with SMTP id gq15mr15111603ejb.256.1608544997961; Mon, 21 Dec 2020 02:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608544997; cv=none; d=google.com; s=arc-20160816; b=iyhT0NF3x0LBYtgCf85unL7VmSWM0YHFhX6fRY1XODxxM+88ZGcHTRzGZTCuc/A2+P HGjoHKaqw0svmuxK8w2NOHNEbANVAHDozzaUiJrduT2zl3FPSRYW3nBg+/xX9tnXED/U bAtu3VwT74K98FM7KCdBmoFti7Qmxm83VlNTznJOLLCU7AgVmSoOF6w+e4AVkqB+1zSA DTW5ojlr4u5K/O0kieh8zbbwXClqGpw/MSUnWH0VXU2LhHrI4KsrCYYbzChss33xcGsE td8BNbr7fiNzgp04HpUB6+iJz+mbtwH9Xzz6Bf1e4/EVMYdoC6KpN7TNTzUgf+w3TFBv BN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=oFWIQKNIyMqgNyobrl4ER7CWdHjmfv7TjA8jn3vjkNk=; b=jxNnbPJMpsggfJo3z8dgexqztApdGJtW1Oo1Yp10dzbHJGFodFF3oW5gX3KpmnqSLN ri1PB+QeJzZHDBfO0YII1uZKB9+XfCi2iirfyW1OSxDYYCEIuvuQq1bIySaCIONzAEKm EjmPfbKgZ+1EQzayG9ZbE9F8/C5K6jnGxc2/CXBQePijXYnrYQlftmuJLjM6wJ5kbl1G ughPRwlk1BoKP9fI3KBmbLqQb748SvTMTlWZI3g/vBVN9KAi6EAKNjubdT5H/RUZlBeQ MUX4GMN1giVyFoUBWdb41uMrmuiwmt3/JdK8pOQZkGhuxr5c1/hgLzygnCnOqhLQt/8n BwfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=L61J9MVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si8732965ejp.67.2020.12.21.02.02.55; Mon, 21 Dec 2020 02:03:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=L61J9MVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgLUKCU (ORCPT + 99 others); Mon, 21 Dec 2020 05:02:20 -0500 Received: from first.geanix.com ([116.203.34.67]:58062 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbgLUKCM (ORCPT ); Mon, 21 Dec 2020 05:02:12 -0500 Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id DDFF6487688; Mon, 21 Dec 2020 10:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1608544889; bh=QoIAAJdcJ2xARRst3umA4sJ7s7wi/Qvh4ASN+q/gFmw=; h=From:To:Cc:Subject:Date; b=L61J9MVQVz0CvG/ywTsNVAhA8yuwqWZizP0l97nYX2IXq3mbR8d5YhcUzSkxw035V TLufyfev/ejpinvQjGC4r7+9+6+uwY15YNG05diQtfYwtgHpuJgyaPIxS06Rt6kD9b jnO/y0TcfMcNl1diIUnbX/hdpLsCwnLofqYw5kT2jFIC0KqjGjIHyp+yD3VCe4flAo f9Mvtfl0KkkSGPu00dN4yEvZCnAtgY3+Jdy9sRX3HCL3UtWqW9YoV/hOLdSPapaE++ X/ZeTV/CjXZDCq4prHW5P7u2wXwB+/xppvFg/LKrrHOM7b7HJRYryTXKeJ4FfAm+ia uZBkJDrx0zoWQ== From: Sean Nyekjaer To: Han Xu , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Sean Nyekjaer , stable@vger.kernel.org, =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: rawnand: gpmi: fix dst bit offset when extracting raw payload Date: Mon, 21 Dec 2020 11:00:13 +0100 Message-Id: <20201221100013.2715675-1-sean@geanix.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ff3d05386fc5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Re-add the multiply by 8 to "step * eccsize" to correct the destination bit offset when extracting the data payload in gpmi_ecc_read_page_raw(). Fixes: e5e5631cc889 ("mtd: rawnand: gpmi: Use nand_extract_bits()") Cc: stable@vger.kernel.org Reported-by: Martin Hundebøll Signed-off-by: Sean Nyekjaer --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index dc8104e67506..f0726e69a312 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -1611,7 +1611,7 @@ static int gpmi_ecc_read_page_raw(struct nand_chip *chip, uint8_t *buf, /* Extract interleaved payload data and ECC bits */ for (step = 0; step < nfc_geo->ecc_chunk_count; step++) { if (buf) - nand_extract_bits(buf, step * eccsize, tmp_buf, + nand_extract_bits(buf, step * eccsize * 8, tmp_buf, src_bit_off, eccsize * 8); src_bit_off += eccsize * 8; -- 2.29.2