From patchwork Sat Oct 22 07:25:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099073wrr; Sat, 22 Oct 2022 01:12:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ygf8pMxN3VOCpYfKBDDcgkX+DBBkciPRrXcsTEmA+CpQf7elcyQsiSNdJi4+g86qaP57w X-Received: by 2002:a17:902:8bc1:b0:17a:a61:ce68 with SMTP id r1-20020a1709028bc100b0017a0a61ce68mr22948246plo.66.1666426354886; Sat, 22 Oct 2022 01:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426354; cv=none; d=google.com; s=arc-20160816; b=iaRxd8ZO0KZU0PqTKS8xkyDGi2ZqcEALqg8YNQj+i8bOBvjhFwlIGwY4kxg08OxYja 4nXTeylBT23h5zNC+we2SfNAsot1+Xx5Z+ddNpC/KiLpTCFcTyzUxumqjxXSpq7RiyiC 6L4veicrPD+r1kdLeYCU1lSert7lxSKBQ16L/1ySzEqNimAueiIvWu2U5H2OtfctWmTZ qMuCPUYj4M8J0q2+WDsDbOBiVYXOVCmHLXG4Mk6G8nWuivqgAgTkVjsPGqL7kOw78Yqd LLjwElxz6lyvXF+EAM9bDhKPLvxGQHpORr8yLF5qGu+Lg+7jBkDq/4ePgCL6tW03m+5Y forQ== 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=o99ZjAm4QpAiPWKLYdRrUCTD/OzQRQLITAXuQuDl83o=; b=ffAqmUNfqmot5s1r0GiETWpDVmvufLPPpU2EGp5qWB9qG2uRBssvWywNnGbdF8tH2G 3N7GVjSW2SCAoTjJKFBdp0on1mmu4svXr19gSMoYa450mhTLITB7AFu5lVcOybqFquiW xalcpzLL02aX2K81nMRCRIl/VzXI/63B+pWy4gKxNdEm/gVMN2vEBDIMdy3E1jUOdyrZ T4CVjUCd/eqFz75/IXsEg3+TUXdiF8/lLUBfiMUgqhCl5EIXLv6MwaCvU1DqdRpvXb+S OOMIUt7TACDmNymqtyTvDi7UgvzT3o91eEFgTFIGQqL9UIBIKN/yRA+Lz0vDHs1v6ep1 ZYOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K8zTKIh4; 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 fh24-20020a17090b035800b00212dc2e1abesi2145017pjb.47.2022.10.22.01.12.21; Sat, 22 Oct 2022 01:12:34 -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=K8zTKIh4; 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 S232709AbiJVILt (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233397AbiJVIJo (ORCPT ); Sat, 22 Oct 2022 04:09:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E9F2C6E8C; Sat, 22 Oct 2022 00:54:12 -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 635B9B82E05; Sat, 22 Oct 2022 07:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 035E5C433B5; Sat, 22 Oct 2022 07:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425243; bh=2aSqJ9LbDxNENvjzdwzi9Im+SVsBxTeYEvCqP3aIeus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8zTKIh4UCFOQqs/YlUJBKaFOdiUyz53wmZL+fFMjhiH3JgydvLuPw5UMy8oxtgLH qGXt0ainVaQCIYYru0uNQuOc9REJzgQ9Rkrr/EXIYu/srptje6NaPMpYpbF57xcQKh Gxq41c+hHFP0EIaKqdKEzd2toCVX9stltN5ZPv/Y= 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.19 438/717] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Sat, 22 Oct 2022 09:25:17 +0200 Message-Id: <20221022072517.733903211@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374681585872505?= X-GMAIL-MSGID: =?utf-8?q?1747374681585872505?= 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 032180183339..b97adeee4cc1 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,