Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1020570rwi; Wed, 19 Oct 2022 05:56:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RaYEpinUiKJGkmFyNhxvka/jRB61F4TtmC/MXRTtxfcs2EHDetBUgtm3zbJLsiK7kMUwQ X-Received: by 2002:a05:6402:10c2:b0:45c:3c87:721f with SMTP id p2-20020a05640210c200b0045c3c87721fmr7603851edu.251.1666184192898; Wed, 19 Oct 2022 05:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184192; cv=none; d=google.com; s=arc-20160816; b=bTunPKDEik0KHeh8WUz1P6CZI9aljaL5WhoL5KqBRec80svmXVb8Zgq4DiHLyja3k0 jAimHwJS+MvZ19+FmOrJR2LMW2v8BJIcwNCd1UlkBcfHc9tDJS+8IFnKdmMagi7Im2Sr mJhbvuWO1vt1n1yCReZ4ws4YmmjTpkSmhWPq4OKPjb8H/4v+nQyad/fNQpmhLfkBRYK3 b0pYuG0c0jCnFjjfAkgK9qo7hcsA2e+aY0UOlhTNOJn6T6B08QB5WyQgNfS37JE6N4oM B+YOS2EC8eVXf/2vlQPHrlMMKpk/jCUSfPbOqw0nJ2FscvsMEPn9WSxaDCCyOtMVqwWl GthA== 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=vgahABATD5LLL7z+7KOGLwKxD5be95GzuVTV5xWbMyA=; b=qlYN1oPpc+8HDLZCAP4VksfeVf1SZMtc+fta+Thy/MlJe6DrvHsdTLvWFPULa003g2 YEttvYG2zAKvpV0/+x67xrnYEK3n2JjLhX5mO+UrxrxfeKQ63nj8fdy3ifTn+ioKPN22 3tnv5urSHxPJI2IMTq3G6qZIsCx+EJOA7L3qctWtIuaT1hdk6pwaZPQlc5eik7+9nspG eJ7a92LP+l6zwi33buv7+a77A1Eh8winWa1LfKj/eDvy03QI5PQEfciwVPnrYObtxxjA IJgg/nwhUXTIvlIVRaMcFnjiUMgesYSTNwIhJD3tI0FcDzPvkCZErxhplFZ0eBdmvxYV 4VhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=048A0v4V; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k25-20020a17090632d900b007891fd91786si11290505ejk.151.2022.10.19.05.56.06; Wed, 19 Oct 2022 05:56:32 -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=048A0v4V; 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 S233009AbiJSMTX (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbiJSMSL (ORCPT ); Wed, 19 Oct 2022 08:18:11 -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 4723E1C39ED; Wed, 19 Oct 2022 04:53:39 -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 C3BF6B8245E; Wed, 19 Oct 2022 09:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2334AC433D7; Wed, 19 Oct 2022 09:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170143; bh=7C+xT1rRzPbiCm43+74AUTchCTj9A/0iYrQyNA+gvIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=048A0v4V6PS1Qm/OwDTLkZ8IGI8tt4dlXBcCQPUUtqqWHfiitndLOQ/cjnsFyzVL0 2VOyCDCwZEnXQtvnqG2M5JNF5fPUZJQilkqIJns/y3G0OafuQGG1oqb628daiPcZPO AboY4HOpFv4IGGNMYFMcQpMNi2Tv5jfbnC2Kn7qU= 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 6.0 543/862] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Wed, 19 Oct 2022 10:30:30 +0200 Message-Id: <20221019083313.949160914@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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 829b76b303aa..ad2ffd0ca800 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, -- 2.35.1