From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 233DBE81806 for ; Tue, 26 Sep 2023 01:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232342AbjIZBIT (ORCPT ); Mon, 25 Sep 2023 21:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjIZBIR (ORCPT ); Mon, 25 Sep 2023 21:08:17 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0B495 for ; Mon, 25 Sep 2023 18:08:10 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RvhNB6WwVzMlt2; Tue, 26 Sep 2023 09:04:26 +0800 (CST) Received: from [10.174.178.209] (10.174.178.209) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 26 Sep 2023 09:08:07 +0800 Message-ID: Date: Tue, 26 Sep 2023 09:08:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [RFC] mtd: Fix error code loss in mtdchar_read() function. To: Miquel Raynal , Richard Weinberger CC: Vignesh Raghavendra , linux-mtd , linux-kernel , chengzhihao1 , yi zhang , yangerkun References: <20230923005856.2538223-1-wangzhaolong1@huawei.com> <1131184426.81026.1695650583370.JavaMail.zimbra@nod.at> <20230925163727.7ecebe9a@xps-13> <488305749.81257.1695653971403.JavaMail.zimbra@nod.at> <20230925170642.089e543b@xps-13> From: ZhaoLong Wang In-Reply-To: <20230925170642.089e543b@xps-13> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.209] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > richard@nod.at wrote on Mon, 25 Sep 2023 16:59:31 +0200 (CEST): > >> ----- Ursprüngliche Mail ----- >>> Von: "Miquel Raynal" >>>> Given this a second thought. I don't think a NAND driver is allowed to return >>>> less than requests bytes and setting EBADMSG. >>>> UBI's IO path has a comment on that: >>>> >>>> /* >>>> * The driver should never return -EBADMSG if it failed to read >>>> * all the requested data. But some buggy drivers might do >>>> * this, so we change it to -EIO. >>>> */ >>>> if (read != len && mtd_is_eccerr(err)) { >>>> ubi_assert(0); >>>> err = -EIO; >>>> } >>> Interesting. Shall we add this check to the mtd_read() path as well? >>> >>> Maybe with a WARN_ON()? >> WARN_ON_ONCE(), please. But yes, let's add it. > Zhaolong, can you take care of it? > >> Thanks, >> //richard > > Thanks, > Miquèl Yes!That is a good idea, and I am pleased to do this. Thanks, Zhaolong