From patchwork Mon Oct 24 11:30:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531395wru; Mon, 24 Oct 2022 09:06:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54pPzelX+8olXwI38ibZaEgSNc4/jpi9yHw14vLvLnWcPucBGVBCXkm+dF9uxUxweCagpw X-Received: by 2002:a17:907:728b:b0:7a1:b545:b39b with SMTP id dt11-20020a170907728b00b007a1b545b39bmr9802397ejc.661.1666627586806; Mon, 24 Oct 2022 09:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627586; cv=none; d=google.com; s=arc-20160816; b=Rn2EymysBOxK5vBVdLFcEo4dINh34ahVV8l+cumTO9SeneURymPrtuUE2+9k2RlwBE 0KhKYSKM0kio3jAK4Klo7VWo/Txf/0CtGbIYxmR9ZbafoeB4/FC3tr4bGqDlR+CaANsn FFvQZWaGpj8Im2Y9iGd0sy0lsekF+8wvVY/yivefNcGOYZkQPEGghlLKWc82+MUK8mtC iA+Hhvph0uebB/ePdc6iQvpq4yEdzHreR1T1sdxhXZZ8PzPlysscMn4xNA69rW4l61yU IZsexDyMN2Q60Ij0rN/TXQwmRuLAMTVpps7BoZFvIZYD73qMfGUWuBWhB1uLfHOk1voi uCcg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yz2N62sTA62P3dx0CMzimrj/t8Lx0IH5AHro4fNAaZ0=; b=x9LxqJowlgdkcXKsLdJkbnIuinxcCZlNsgSsijMieutdS5GzoRQYaC2u7XJ71G5et4 fWBg49WIB1m0+JuFMo9GsdCS4v+OR0pLiWUdSrnC4YTZjkpkMz81ROGQSr5GUeqfwnPd /dEE1lPVbyoS1/6GV72JuK4BODjzzuENu8N6eyz6BQ6pqLJKudCKVSSNus3pBh7RPNKL 617X6ImUpFKnv5c+M4KUEV+DgDlqzXzylBuZNe1po1Hxq/io2uw7D/lyNyk4VNbsB8O6 z6GAfiitknOMypjSwvj3VPEu3Pe3t7Lc/A3iple3QyIKMSyeGFXqkih2Fq4cHitvEn97 snyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vm+mzXeE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a170906195100b0079857369ed4si122604eje.223.2022.10.24.09.05.48; Mon, 24 Oct 2022 09:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vm+mzXeE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbiJXQCy (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbiJXQB1 (ORCPT ); Mon, 24 Oct 2022 12:01:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6686EE8A8E; Mon, 24 Oct 2022 07:55:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77659B81201; Mon, 24 Oct 2022 12:25:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC7B2C433C1; Mon, 24 Oct 2022 12:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614350; bh=nE7ypUANDIJpipcxO0dxAb6r1ge/slva74N+RfEwMgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vm+mzXeE4OwSWmiwsN+MQ/EaJc0dzMVmq2mE6GTp1fs+ShUK+c1pd1ODjYE2UdY3p MdUhPVlJqEPo3Cflk4fyNYkt8l3R3ZZAF+6gdJoHxH7kiQVlivyodzVKAM74jgqcPY cBiNTzTHeFJjrBrRvhKpVkByEEduPaeEEKgEItQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Liang Yang , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 228/390] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113032.487816756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585688687805402?= X-GMAIL-MSGID: =?utf-8?q?1747585688687805402?= From: Dan Carpenter [ Upstream commit 3e4ad3212cf22687410b1e8f4e68feec50646113 ] The meson_nfc_ecc_correct() function accidentally does a right shift instead of a left shift so it only works for BIT(0). Also use BIT_ULL() because "correct_bitmap" is a u64 and we want to avoid shift wrapping bugs. Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Signed-off-by: Dan Carpenter Acked-by: Liang Yang Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/YuI2zF1hP65+LE7r@kili Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/meson_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 327a2257ec26..38f490088d76 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -454,7 +454,7 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips, if (ECC_ERR_CNT(*info) != ECC_UNCORRECTABLE) { mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); *bitflips = max_t(u32, *bitflips, ECC_ERR_CNT(*info)); - *correct_bitmap |= 1 >> i; + *correct_bitmap |= BIT_ULL(i); continue; } if ((nand->options & NAND_NEED_SCRAMBLING) && @@ -800,7 +800,7 @@ static int meson_nfc_read_page_hwecc(struct nand_chip *nand, u8 *buf, u8 *data = buf + i * ecc->size; u8 *oob = nand->oob_poi + i * (ecc->bytes + 2); - if (correct_bitmap & (1 << i)) + if (correct_bitmap & BIT_ULL(i)) continue; ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, ecc->bytes + 2,