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=-18.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,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 45AC7C11F67 for ; Tue, 29 Jun 2021 16:19:35 +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 98DE461DA2 for ; Tue, 29 Jun 2021 16:19:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98DE461DA2 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 67CDC8319F; Tue, 29 Jun 2021 18:19:28 +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="ph9dDvns"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3B2283184; Tue, 29 Jun 2021 18:19:24 +0200 (CEST) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 855648318D for ; Tue, 29 Jun 2021 18:19:21 +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-x435.google.com with SMTP id i94so26557475wri.4 for ; Tue, 29 Jun 2021 09:19:21 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ufGbvMIFrqui52/UoqnW+7ImFx2sfm3d4WUD2Z8YHQ0=; b=ph9dDvnsRKFqnZGWSAVICF41UkDrA1BolGWLedzMz5d/H0aDeP3PyBcQH9vCzvHqaG AEYSPIFBDmJzGLl3t6q6U56lP3+AENBgLwmNPVCjUWl1ye/v4pd9TxzTLPwBiEifY8Do 9XVCBCym03/88VMWZptGYZW3sCrsdLdVsK7kk= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ufGbvMIFrqui52/UoqnW+7ImFx2sfm3d4WUD2Z8YHQ0=; b=GiQAX0VGqwkxel1MgwQPR4rEY05pgFmFlMGzESEUUdl2Sl+xpouKlp0ccozUNteXN1 qCV8Sm1X0lBiN+qhcZxZZG/wvTfkQ38Sr6dhbuDn2bi1SgmlBqp5xnY11oLpsDygdFpR TSMyqmXVLnopY0KIXfMv1PTPlQi4tv8aVQETcPzb8qof/ZeE6L7BLh/KFVddEgUD3ktF qpuOtBXZvpnYT9RJ/blPqUlLZ+3AOoGai8D3TMMeMXMppiBzQI7SWWmwTys7imgxdRZZ KUHPq3Mp3wRJPQrvmJttcFwDHrCaNfZqVAGfwL1eSIC6WzdOhpw1QARK2F2R4TKWvWwa WDvQ== X-Gm-Message-State: AOAM533VbRqHSD79mKUeex3y8GAzRfwPpEUc10L3EYuX0xRqySbdyLL6 bEKIa7FCvFdxiQu/B/BImS/V63ucGxi6apqu X-Google-Smtp-Source: ABdhPJw5kk3ZB7X9SnVwuVgf2Appz8rlK3IWDD4KcZUcvKPVitbjU86oPD/QkASH28k4dh4GFDKS9Q== X-Received: by 2002:a5d:6446:: with SMTP id d6mr12559091wrw.359.1624983561224; Tue, 29 Jun 2021 09:19:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 09:19:20 -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 1/1] cmd: nvedit: Forbid key to be empty. Date: Tue, 29 Jun 2021 18:18:59 +0200 Message-Id: <20210629161859.298630-2-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629161859.298630-1-francis.laniel@amarulasolutions.com> References: <20210629161859.298630-1-francis.laniel@amarulasolutions.com> 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 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..6f99a85a9c 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 (*name == '\0') { + printf("## Error: variable name must no be empty\n"); + return 1; + } + env_id++; /* Delete only ? */ -- 2.25.1