Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2078674rwb; Thu, 19 Jan 2023 20:41:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXs3bWm6XRc0DLzEQyROUjknoLuZTjwEUlyrzFGN/iBJEY3BiCjf4+9RxjznJKddJaWCcO8f X-Received: by 2002:a17:906:af6e:b0:7c1:5b5e:4d78 with SMTP id os14-20020a170906af6e00b007c15b5e4d78mr9677099ejb.51.1674189712992; Thu, 19 Jan 2023 20:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674189712; cv=none; d=google.com; s=arc-20160816; b=WfMCQpyxEs4A6yKKOZ8AVeJNqWPXsErVAgfIVELb6qzT6Pg0F92YOkRo6RaNfUoucN NeNq6B+ghEbfaaagvj1mZ8yGWit8HUdyjVrVUY1wKT/6EWtQS8gi3SYK3QhAvlbjxFss RYcXo0dHvmUKsiLf9FsbGmN6Vz6khAzOzxPYluE94V5lzpXLr46UHduqQO7vB/OGtZi8 apxnBqzhFO3RYG/jjMwYkoSAtAUgFfaqAhjGjhfSg8mJkRx5jgfOH+47RTee1YHiiJyK Mtrpqk5YgNl+xcF90RHdt5IGvVq6cIRvmIrfJ1l8BIpCW04sX/2joJKT2/HhZt0Q3Qys O9jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=iezSynNH5W1oFTWX7VE7fYRtxIVPYwi3S16nlZLNrIc=; b=lphuOgWE4nvPM41de/sNsd4g+fszd0BuukH/uRaDvGQ9uTuwi1fNcCZLx2/Qv1z3Ma m8oeF9bkptoLIIJB8j1LurWPF5iCjZ/b1xp0cXOlxork7v36BG3ekLgFIpfxco0a+YVa gR2Fcl6Oq1uK2Qs5LuV8QuLh7cReoUn7amFhJalxE3/E2aS2WXhH0IKc8Ol0HFYMEh03 r2MRK0AI37iQiSqH0c6T2vq27UYYHAbm9Q0qltOcxz0GODJl9VvxfKuDlGPZviryO6dX Dm77m7pfnWkt7ZRwBipSNHxwYhcWUoVgAp9RU/HaZzp/St+JQARliCa98Xws8VBcbzEX 58jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="p9/6wEPY"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be5-20020a1709070a4500b0084c9f6cbe3asi41179821ejc.843.2023.01.19.20.41.40; Thu, 19 Jan 2023 20:41:52 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b="p9/6wEPY"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjATEcB (ORCPT + 49 others); Thu, 19 Jan 2023 23:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjATEbp (ORCPT ); Thu, 19 Jan 2023 23:31:45 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553FFB2E4B for ; Thu, 19 Jan 2023 20:31:16 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 30K4UDN0117944; Thu, 19 Jan 2023 22:30:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1674189013; bh=iezSynNH5W1oFTWX7VE7fYRtxIVPYwi3S16nlZLNrIc=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=p9/6wEPY16TKS1V4cFMywOK3klEnssGDfRunmqGvKUXBQImQaleB986h94DZ13CYR h1PPsT1URYRc2/FZC2XEco1Q3APXhHjIdgKTtH0KU0Eor4JUlQ0XzTQL0U75bUz0FU +WzvjJDPYc0FwFYXoY2WNHviv1DJvbdEkWXghdBM= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 30K4UDOE094394 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 19 Jan 2023 22:30:13 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 19 Jan 2023 22:30:13 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Thu, 19 Jan 2023 22:30:13 -0600 Received: from [10.24.69.26] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 30K4UAwc026047; Thu, 19 Jan 2023 22:30:10 -0600 Message-ID: <6a5f3395-8f1f-5bc3-29ce-205686ff704a@ti.com> Date: Fri, 20 Jan 2023 10:00:09 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] mtd: spinand: macronix: use scratch buffer for DMA operation Content-Language: en-US To: Daniel Golle , , , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra CC: Mason Yang , Jianhui Zhao References: From: Dhruva Gole In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,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 Hi Daniel, On 19/01/23 09:15, Daniel Golle wrote: > The mx35lf1ge4ab_get_eccsr() function uses an SPI DMA operation to > read the eccsr, hence the buffer should not be on stack. Since commit > 380583227c0c7f ("spi: spi-mem: Add extra sanity checks on the op param") > the kernel emmits a warning and blocks such operations. Good catch! > > Use the scratch buffer to get eccsr instead of trying to directly read > into a stack-allocated variable. > > Signed-off-by: Daniel Golle > --- Reviewed-by: Dhruva Gole > drivers/mtd/nand/spi/macronix.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c > index dce835132a1e2..722a9738ba370 100644 > --- a/drivers/mtd/nand/spi/macronix.c > +++ b/drivers/mtd/nand/spi/macronix.c > @@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand, > * in order to avoid forcing the wear-leveling layer to move > * data around if it's not necessary. > */ > - if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr)) > + if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf)) > return nanddev_get_ecc_conf(nand)->strength; > > + eccsr = *spinand->scratchbuf; > if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength || > !eccsr)) > return nanddev_get_ecc_conf(nand)->strength; -- Thanks and Regards, Dhruva Gole