Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5332186rwi; Mon, 17 Oct 2022 19:48:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XNuMVljCv6nFbo7whOfhNMELoOqotFTrIbzbb6xq31rml16xmv45fiFSMXqxl8OfjSvIN X-Received: by 2002:a65:4084:0:b0:463:aa4:49cf with SMTP id t4-20020a654084000000b004630aa449cfmr787506pgp.164.1666061315573; Mon, 17 Oct 2022 19:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666061315; cv=none; d=google.com; s=arc-20160816; b=X0+bANr38qr4aFwnHmNMynun4glNQN6t//l/ehWyqq4oqLmpFgfzPKrLFDIg1rIBAh iUDAZl5o1KLnTaV8iSCmqlC/6Rr6jP6uaG4HaZPHO+gZdp0Vx34E9i3Zk2wfLLiCk+bc Bfl2nmGes0nRI/mHUuWAamTwqXG6bZ4oL18knoPaC05BrTwRz4f0/KfToPmIYdl/jGQp 5FH7rXt3NftD0L01mt2jy1B/dEsGvIRHKl419SYh1pznp4YYBH8UhhLx23JqjksFeemC DR3rmZtlErd+raTIAyg40QcOmLQc9c/7zA+yK0v3hg3kTxDCOKjlUJpac9dwjPQ8Bp+Q KBRQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SW4UEfR/NQk1QFxtBY83RzVii+9b61/DJ+KqTvPvmFc=; b=x6A279kNRSfa30Rq8B8Ji4c72VSPP/3/WYiSpwr6kxCRUQCJScWOaTEwUz6VllAL2a lY5Z/I81ebfcaTQ6YQLOq8/pEjCHPhqhh5QyxlNmavoBD3VMietYiVfa53yAKl2VIcGn nHtkS1kiXINcnHr02n3GihVzHeycSIEptODHAedQ2u5B9S4eOuyvu1rnQm3rQScXUQu9 /A4M7dxGiJC5d/C2mYUdWgGScxCPVVbUURK6JJvuBMog4Kv+NU6RyL5ebTX7255JBk/o a1CJSJYp3rBBT9lJMPO2P/K379qFTT3fYFf5xi+0ucrL1yVWfflSmG9htb7JfKgI6qC1 fwrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=pWk9ZE6Z; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15-20020a170902c40f00b001715a583d46si17437761plk.474.2022.10.17.19.48.22; Mon, 17 Oct 2022 19:48:35 -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=@linux-foundation.org header.s=korg header.b=pWk9ZE6Z; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbiJRBza (ORCPT + 99 others); Mon, 17 Oct 2022 21:55:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbiJRBz1 (ORCPT ); Mon, 17 Oct 2022 21:55:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 074FC3887; Mon, 17 Oct 2022 18:55:25 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 93C7B612F4; Tue, 18 Oct 2022 01:55:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB2EC433C1; Tue, 18 Oct 2022 01:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1666058125; bh=igcQugxTzwIP0PYHpWw1TgW9tEWJhVuc8WaXwlkC/Ok=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pWk9ZE6ZgxOhyz8+YbsYxk4DbRYG+eJfnTSaDfEw5L0oHwDlqnFhF7X2RKWCJ3xiw a+l7VKQAFH39/1QkFwV03tTCE/RYQwQVtIbVzFGePGML7pBVzLaEqfc9f313SRqAsB D4yiNzfpDPFoNp0yTNeFlOkoC6RaDOp0CNwC+NP4= Date: Mon, 17 Oct 2022 18:55:23 -0700 From: Andrew Morton To: Ian Kent Cc: Al Viro , Siddhesh Poyarekar , David Howells , Miklos Szeredi , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Subject: Re: [REPOST PATCH v3 2/2] vfs: parse: deal with zero length string value Message-Id: <20221017185523.22f43b5d7f9fee1e1e3d872f@linux-foundation.org> In-Reply-To: <166365878918.39016.12757946948158123324.stgit@donald.themaw.net> References: <166365872189.39016.10771273319597352356.stgit@donald.themaw.net> <166365878918.39016.12757946948158123324.stgit@donald.themaw.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 On Tue, 20 Sep 2022 15:26:29 +0800 Ian Kent wrote: > Parsing an fs string that has zero length should result in the parameter > being set to NULL so that downstream processing handles it correctly. > For example, the proc mount table processing should print "(none)" in > this case to preserve mount record field count, but if the value points > to the NULL string this doesn't happen. > > ... > > --- a/fs/fs_parser.c > +++ b/fs/fs_parser.c > @@ -197,6 +197,8 @@ int fs_param_is_bool(struct p_log *log, const struct fs_parameter_spec *p, > struct fs_parameter *param, struct fs_parse_result *result) > { > int b; > + if (param->type == fs_value_is_empty) > + return 0; > if (param->type != fs_value_is_string) > return fs_param_bad_value(log, param); > if (!*param->string && (p->flags & fs_param_can_be_empty)) > @@ -213,6 +215,8 @@ int fs_param_is_u32(struct p_log *log, const struct fs_parameter_spec *p, > struct fs_parameter *param, struct fs_parse_result *result) > { > int base = (unsigned long)p->data; > + if (param->type == fs_value_is_empty) > + return 0; > if (param->type != fs_value_is_string) > return fs_param_bad_value(log, param); > if (!*param->string && (p->flags & fs_param_can_be_empty)) > > [etcetera] This feels wrong. Having to check for fs_value_is_empty in so many places makes me think "we just shouldn't have got this far". Am I right for once?