From patchwork Mon Oct 24 11:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445152wru; Mon, 24 Oct 2022 06:12:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5S8eKCWOgWN7eah5NTdv3kP2HxaDcTIwZOcWOQn892CGFYJuMPS2p5M8gcZb+Lfd9ZF00h X-Received: by 2002:a63:5a26:0:b0:463:7ca2:653b with SMTP id o38-20020a635a26000000b004637ca2653bmr28644159pgb.352.1666617130833; Mon, 24 Oct 2022 06:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617130; cv=none; d=google.com; s=arc-20160816; b=XXEO68pcXXK8Xoxs3iGsld+lTT2Ddt97MfD1IycLOHx9owRlCwhYMnstjVWdRNkkYU MxiV1O54quNNuDkUoMwCfuyW5+T1TuqLsdn6nnttspDOm3S/oOUZLNvwdh7jgtXZv9Tl XBtcQyUa8a+Vuk6Zj5Fto1hPzxXgbM5S9+XfOdZniIGeFOdRNvM0cqgA2QoCaZnKxp1Y OQRkJCnkzPlZPZnfPX8zAFY/FJ4GAWhHVPiEi94jNVmMlA7MEm3BD+QOSgVMf/f/5uSF pL8NOG3VMu3nfCTz4jDe0ZvckR2rLoadpdxvN1eksivft/t+SN57F8YcY88pmw33TlGM CXag== 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=PbFYwv7wkS925NNqdtkFPQRaDcfPese6Q58u8KJgPBI=; b=e1wAGRIUeLyIvoVvLtBHu0neWTalCgvJ5IK3xcEOA/crU4Sq+pTQEzJtQl49YV/vVT 6oMlFkpmO3aXHQSv3GN95bITU5CwtT51yUOr0P/84I4ObOR8DW8VnysI5L3xEDSnY/oz koGf4Rl4j1WymWU6FveTCShB+MKlm0/3+qYU5kmMs/s2/Yj4ZvAT20wXn5ZFswLWQ3T+ Gz5nFb5O+K+UEUpRSKL1OPQ/bkex4XhJ4o0NZiAxcvO8+8uHmJEHqXoNoZCDM4YrMftY 33mYK7xdHdT15aTLh/ct1uwaM0LvQ9R0/xK/diYRFNisMQN+K2jpyQsYLpgHtX6fhP0y o0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nIEXaxKv; 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 q7-20020a17090311c700b0018128753b2bsi43599051plh.437.2022.10.24.06.11.54; Mon, 24 Oct 2022 06:12:10 -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=nIEXaxKv; 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 S235604AbiJXNLe (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbiJXNJD (ORCPT ); Mon, 24 Oct 2022 09:09:03 -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 DCB299F367; Mon, 24 Oct 2022 05:22:11 -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 83509B815B3; Mon, 24 Oct 2022 12:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D884EC433C1; Mon, 24 Oct 2022 12:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613461; bh=5gRo8IX02SsCQBABh41eIAqNTl+yzSyxn8vl9XNFPkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nIEXaxKv4lGWbcNS1eOuc9iqurLvwsK+nhlhDXTCIWEnT+Henla8f/UgPxlXOc7Vr OVOatDsoYUQpSPJf5uLgB6RTJ+RqrSD6hFkt5bDw8ERXjv+Y/KpJlgMVbDNTX8V2lz 95S1d3xspAgxDyKcLgi//VW09GVpieFinn9m9G9g= 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.4 145/255] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113007.441345681@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574724310891350?= X-GMAIL-MSGID: =?utf-8?q?1747574724310891350?= 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 28dc26e1a20a..a65aadb54af6 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,