Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1313044rdh; Mon, 25 Sep 2023 09:00:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnZY37BnWl4wqTgCEAUSPsA36D58B6UToyIwKQRZwJ5xsnV6XMNCaRnCM7zJRYXO+Iuwgi X-Received: by 2002:a17:903:2351:b0:1bf:25a1:9813 with SMTP id c17-20020a170903235100b001bf25a19813mr8567584plh.6.1695657606917; Mon, 25 Sep 2023 09:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695657606; cv=none; d=google.com; s=arc-20160816; b=JCY/NOSagn0wzCTbnWnaHY0lduIW1P6/tzpUtFW+8xuKT3aNl+thuEy6GzDrJ1VTL7 d+j7tHz0Zs/1mFZWlhk5/nXnC8XLgzvgZ5Vb8BZ5fvxuZ1KOG/buUD5OMAaz3WcGlD9k kA90z8CwEhidK1GIMKN9cLCAkFwtBAsKK92iKbPjSqQ+nhf5uBbIXzABHc4X7RiUwBO2 oeTDG+MP9cj2QsH1KH7stMgPOoUKL7djpcFFngjQyQsg5ppsV993NjEhF+nXL+fBypC2 ZwRflfif4hsUTex/sTfZBS6mv59YZFFcSVz6V9Z1P4K+ItRONUzTu19iLCMnfQEYiLWM LlGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=B20SARGGYYOHwBvGr64VoG9lNRYFhAmgtQzapwXhXy4=; fh=/EMS/8Gj3bhZaORFvfrnXg0KOYgm2pMf3ZYeedP1Ztk=; b=EAIdhTLFaYm45gQPotOogYSGd048mkTcpAaqPSTt0+2uFH0ezo655/9LhhbofgLxiw 2lGWKQqSSesik1eNZyKYyjAS1DwvnjIn0sroWUQSGI0zR1i4Xmb9fxUS54YqJJkZEelQ +ZZxx5AvYdxoU0F/WW7h5XhKtz3fB9w+VXp63fNpf+ZfinnS/xGkB5IgfezCxQSXP8Sv EFVw7LrpRdbmOzla+YMRosYlabUOdarlKC8zi92vuqwr3XVMqie+7wOALWoM2eez45mj XJ5XXKwnzSVL+50ry+nUO9b4lEauvluTwZZimC+gT1VteduSJFem4noRU3Kw+o9nxAei v9Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q4-20020a170902dac400b001c568490749si10537297plx.502.2023.09.25.09.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 09:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2F89F806BE28; Mon, 25 Sep 2023 08:00:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbjIYO7u convert rfc822-to-8bit (ORCPT + 99 others); Mon, 25 Sep 2023 10:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbjIYO7k (ORCPT ); Mon, 25 Sep 2023 10:59:40 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72734101 for ; Mon, 25 Sep 2023 07:59:33 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 2B679635DB44; Mon, 25 Sep 2023 16:59:32 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2CG2CtXr0tWR; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id AF815635DB53; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IIRgHpfaaJM8; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 8A104635DB44; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Date: Mon, 25 Sep 2023 16:59:31 +0200 (CEST) From: Richard Weinberger To: Miquel Raynal Cc: ZhaoLong Wang , Vignesh Raghavendra , linux-mtd , linux-kernel , chengzhihao1 , yi zhang , yangerkun Message-ID: <488305749.81257.1695653971403.JavaMail.zimbra@nod.at> In-Reply-To: <20230925163727.7ecebe9a@xps-13> References: <20230923005856.2538223-1-wangzhaolong1@huawei.com> <1131184426.81026.1695650583370.JavaMail.zimbra@nod.at> <20230925163727.7ecebe9a@xps-13> Subject: Re: [RFC] mtd: Fix error code loss in mtdchar_read() function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: Fix error code loss in mtdchar_read() function. Thread-Index: OEbc/pJ3ZpcGhIHTGpc8YMoVo8AlzQ== X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:00:16 -0700 (PDT) ----- 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. Thanks, //richard