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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 DF6C6C11F67 for ; Tue, 29 Jun 2021 16:19:27 +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 C649061DA8 for ; Tue, 29 Jun 2021 16:19:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C649061DA8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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 D0089831A1; Tue, 29 Jun 2021 18:19:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="CJf7HN72"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C83883197; Tue, 29 Jun 2021 18:19:22 +0200 (CEST) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A026C83188 for ; Tue, 29 Jun 2021 18:19:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=francis.laniel@amarulasolutions.com Received: by mail-wr1-x42d.google.com with SMTP id i94so26557376wri.4 for ; Tue, 29 Jun 2021 09:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GkV9HpurOK3zI3iSwFpEcrtCGwziO6SDbyCvWOHQWPE=; b=CJf7HN72cgwg8yWGtlIUkM5N7O3qk1YelVG1RT3Q9dCX1boeGiX3y+Dh8s84XMnx3H QvmNr32oYAi991COCCqSKBji/f0qBNuHFRvDsV2aW8TVx+N1JdvRIsvGAEUGAFCvi0AA UF+TtKgqd0Qyx0x0n3vCWiw5ylM2BvR4/JMLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GkV9HpurOK3zI3iSwFpEcrtCGwziO6SDbyCvWOHQWPE=; b=NNc/wSaoN1whFGl2ZtOzZyEwFZZwNZFt47liqqjVKcfWIFTFsquNan0+XRZp8ifFA3 WBtBc+hJujohm0TAOlXt5jGiZ/wFCTowk05q3evKAETtH3e/sidV/Z55Mt3lA7r4CGpx U/rIz1Eulofuh8UVUMXJrl7Mid3PaNDF39MJ60hgREFOBEBWCpTOWBBd4CUURUa49k9g XAIaaeyBaxhKYHyIHc4RXcEcAeXT/J3bTP0IOvDgWtzUeFYFyBsBvCtu066fu5T1/c8x SRNCmCA+eRLVSkRcc843qnfNQMkyuc64+LRD+PCglGiLbFdsceQpfu/eQOehfrA8Dw94 Z+zg== X-Gm-Message-State: AOAM531TgeITsxhUdcMD4So5Mcknvv0exRExGJzqt3bWl+f23pAFMJMj zUmsCJaWw1U63iqaV/EIx4q/QlE7fvrVigmo X-Google-Smtp-Source: ABdhPJyrOwt5LlDfoDBzNj++OpPVm+XlHoWm82+vmImKs0s+4lBzjlzn208m57pIbXAVVUIjE7Hucw== X-Received: by 2002:a5d:6a81:: with SMTP id s1mr7981386wru.41.1624983559255; Tue, 29 Jun 2021 09:19:19 -0700 (PDT) Received: from pwmachine.home ([2a01:cb14:983:1f00:1a16:c3e8:4923:ef6f]) by smtp.gmail.com with ESMTPSA id b8sm3577524wmb.20.2021.06.29.09.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 09:19:18 -0700 (PDT) From: Francis Laniel To: u-boot@lists.denx.de, joe.hershberger@ni.com, wd@denx.de Cc: michael@amarulasolutions.com, ondrej@amarulasolutions.com, Francis Laniel Subject: [RFC PATCH v2 0/1] cmd: nvedit: Forbid environment key to be empty. Date: Tue, 29 Jun 2021 18:18:58 +0200 Message-Id: <20210629161859.298630-1-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi. First of all, I hope you are fine and the same for your relatives. In this patch, I modified the setenv command to decline empty variable name. Indeed, it was strangely possible to give the following to this command: setenv '' foo Which results in the following belonging to environment: =foo And which in turns leads to problem while rebooting: Loading Environment from Flash... Cannot import environment: errno = 22 *** Warning - import failed, using default environment This error message is due to varname being empty and was added in [1]. With this patch, executing the above command will lead to the following being printed: ## Error: variable name cannot be empty And the environment will not be changed. Here is the diffstat for this patch: Francis Laniel (1): cmd: nvedit: Forbid key to be empty. cmd/nvedit.c | 5 +++++ 1 file changed, 5 insertions(+) Change since: v1: * Replace call to strlen by test if variable name is '\0'. * Modify error message printed. If you see any way to improve the patch, feel free to share it. Best regards. --- [1] https://u-boot.denx.narkive.com/P4aKxVFu/patch-env-don-t-add-an-empty-key-to-the-env-hashtable -- 2.25.1