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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35586C11F66 for ; Tue, 29 Jun 2021 08:29:16 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E234261D72 for ; Tue, 29 Jun 2021 08:29:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E234261D72 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F7E382EA7; Tue, 29 Jun 2021 10:29:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624955353; bh=MLfhq2WGo+j6rxddmEfQ5aFz2NFjM7CMRPfA2C96Xys=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=V+hZqKwMykjlz6qm+THT8lNxNqL148DHmTCEtoOYaAXDpyfjp+Ul5lXjxJeRcY4hb X1/j2hfhtJkHKnMhVtL5oIXXB4auVQdOxpvrMfU0uLUf/OmD4Kv8QtHY9NrbAbltPg eSxei1bwEdy5H3zB5oIu7HCUVppdiqILNC56EvvpjWPRXog8sA8DMJffh6H7Fg1tzI uYsJRYUcIN27HHSWNvpgsLUdZI+m+q0WfCe0CWvNKuudVgP0g3IMzaIf39pBI2k+TE 74iITMeKgx61smF+pdeuJuZyzf9BrjZ4JV+R99ghgif6kcg957wpND6jmWdld3u6sw kZ6PVIq0c5Vsw== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1057F82EA7 for ; Tue, 29 Jun 2021 10:29:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624955352; bh=MLfhq2WGo+j6rxddmEfQ5aFz2NFjM7CMRPfA2C96Xys=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=YxUxyPbkCBSMldhl6Hhlw2L05iEF63prlx6JCVXgelfKJawUV7xTYMQbwnk7Dxmbj hLBQ7oU5WbKUJ/ZsEn4gxc9Z7fGeY/g0uVotcMpiQEHfkKHC7rldkls8nGqvTJWNFD d9UU6g3wha6v2BYDf/i/zzx+eudp14H8gtz638TjrKaMqZllQUsYasjwuLemwlYg4F S2m4Od9iQdbnCNbbnRGONKAwrO1X5iPwYFrXqwz2WP56yHfJ82KZ/0qRoCVP0+67jt xCSApBnNnhrK3IdCFnSJteWzMdO0mN2gVmZOgUXCB98ZgczESB1VmT1hhTpkSAht80 1ylx1kZce9meA== Received: by janitor.denx.de (Postfix, from userid 108) id BEBC7A025B; Tue, 29 Jun 2021 10:29:11 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id 6D052A0165; Tue, 29 Jun 2021 10:29:06 +0200 (CEST) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 297EE1E1DD2; Tue, 29 Jun 2021 10:29:06 +0200 (CEST) To: Francis Laniel cc: u-boot@lists.denx.de, joe.hershberger@ni.com, michael@amarulasolutions.com, ondrej@amarulasolutions.com From: Wolfgang Denk Subject: Re: [RFC PATCH 1/1] cmd: nvedit: Forbid key to be empty. MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <20210628193145.796999-2-francis.laniel@amarulasolutions.com> References: <20210628193145.796999-1-francis.laniel@amarulasolutions.com> <20210628193145.796999-2-francis.laniel@amarulasolutions.com> Comments: In-reply-to Francis Laniel message dated "Mon, 28 Jun 2021 21:31:45 +0200." Date: Tue, 29 Jun 2021 10:29:06 +0200 Message-ID: <83528.1624955346@gemini.denx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Dear Francis, In message <20210628193145.796999-2-francis.laniel@amarulasolutions.com> you wrote: > Before this patch, it was possible to do the following using setenv: > setenv '' foo > Then, on next reboot, U-Boot will not be able to parse environment due to it > having: > =foo > > Now, if the above command is given, an error message is thrown and environment > is not modified. > > Signed-off-by: Francis Laniel > --- > cmd/nvedit.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/cmd/nvedit.c b/cmd/nvedit.c > index d14ba10cef..64b7aef78d 100644 > --- a/cmd/nvedit.c > +++ b/cmd/nvedit.c > @@ -262,6 +262,11 @@ static int _do_env_set(int flag, int argc, char *const argv[], int env_flag) > return 1; > } > > + if (!strlen(name)) { Instead of calling a library function here you could use the same shortcut as in the patch you referenced: if (*name == 0) { > + printf("## Error: variable name cannot be empty\n"); s/cannot/must not/ ?? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de "The fundamental principle of science, the definition almost, is this: the sole test of the validity of any idea is experiment." - Richard P. Feynman