From patchwork Tue Dec 4 06:46:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 152794 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp7733620ljp; Mon, 3 Dec 2018 22:44:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xf8XLJf7OvZaxQKWyABgwbdHmbxW7kvY2/COSg1U1j27Hmpofmueq4GVzwALecdenrlEzy X-Received: by 2002:a50:e691:: with SMTP id z17mr16542931edm.275.1543905866971; Mon, 03 Dec 2018 22:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543905866; cv=none; d=google.com; s=arc-20160816; b=iFS5AcdbTiTLdKQHFuhYP13SdYEd4Rj9L+StiGsamNePStzWn0JxywR/IfWjrmPQ2w 2TdKaRky6nlr1TG+nMcc0oR39VmCZyuRfqPkxI3d5c4ATPWDJthAPfpOT46ChP//lGk+ t6u87IWd1wSq8NUJth5ZsjX+JWNsWkLD4gj375MJX7ot0NioNgybNgznmM2O3+F6OCil wNfdeU7mn1QW7ew/05Yq5K6D1dDENjGmiBu9Ee62z7RbB+zBfJm6XamJ+mjrbNEsb7nZ JbcIXBvxnito9sMT62zcfdVzNayofek4rTtL8CRRtxtTHNZ+zQ47N6766Nyz7HxYAt2E BfjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature; bh=1E5BU6d/dgJYP6DLPtZi80+dve8LDX6NKt+igE+MKYM=; b=GTA9I37Mbwaf/Tquk+CkyOKJx3+PQPwDIV4iezcCuW4sGCbY/stdBFrOPWwUKrx6h9 V4wNADbl50FwizrhqrRWpTyI6SWCFYBmph7qn8ZQZ2V2y8yBXgdTLGT6QbP40anhea1G 4Sd3D5CAa0yHe4LVqRyKWl6/1V+W3hbjTAvB2ShE4eZC3n2numZshIvvRh/AjhxR7P2J xrg5T3l45fTSkgJqzSYotJODfmyW9IjW4hsnNrxy/KhRUEMyafEwgpXRW6wzwf04bR1x gwwgBX8t/YbIkDAGc7o8on3AH1Kn0+jk7+JEeivYkZHsKv3METt0BWfCppC7gFcKIm5B HxWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RsImA2FU; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id i12si3379186edq.264.2018.12.03.22.44.26; Mon, 03 Dec 2018 22:44:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RsImA2FU; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 6123EC22381; Tue, 4 Dec 2018 06:44:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 48744C222F0; Tue, 4 Dec 2018 06:44:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B97C3C222F0; Tue, 4 Dec 2018 06:44:19 +0000 (UTC) Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by lists.denx.de (Postfix) with ESMTPS id 3BDFFC222D0 for ; Tue, 4 Dec 2018 06:44:19 +0000 (UTC) Received: by mail-yb1-f194.google.com with SMTP id w129-v6so4834469ybe.4 for ; Mon, 03 Dec 2018 22:44:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v2J7HDHgkeh6lLpWzpZS0SIb3LyDPvuIKp4rgGNkCio=; b=RsImA2FUHfqxYZE+Fv0D1Q9XMGtjYXslbQAQfttpG/wWWV9uVNudcbDK5o8M+Khnde 1HGnHIlRCCLqW3UW/9GRxMAQed6YqRJpQS+b0BgpaqJeRYb9HCI3pM0GHgylPujPL2C7 Glr9JpB1Vn8yNjl2yy7SJmyXj76Vk3V4fpqjc= 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=v2J7HDHgkeh6lLpWzpZS0SIb3LyDPvuIKp4rgGNkCio=; b=Pg3FOLgTLPKsUNxFVI+ciusBHeEdpBKwmkcf+fhCeK0dKYRFgFcvQp/K/DcFM2jr4t tBaQTjQw3nwNme5vIwhkAYbaUoaO9BhzOa13jQWVVDNCNhVJCcN6RRPxBzMjLCSqIHhA 356eEzbKCCG3V0OtZfhiVzGsIDikGV0qyVtb1UTX2mDnHIY11GoKBLIVnC+bQtOXgDl5 0Rq9+2/p+j6GU4O7C0m3HMVNkkacV6fZdr6ilaRwTUfT7dafGiOeYuBsG4rYY8mCFiAP gIVY3K+W0BS4p57H3p6byRPgkrKWCy+3a35f5S4tboIqsncCu+e1GZ0aqyErXEkGRwpQ aBHw== X-Gm-Message-State: AA+aEWbqOAHczR3BOtWHd94WsYdL7Qvf5T/ZchCcWj85JogP5kC8d/xL ijhE2lI4/F8hdVbMqhVJw0mMJw== X-Received: by 2002:a25:8743:: with SMTP id e3mr2402545ybn.133.1543905857900; Mon, 03 Dec 2018 22:44:17 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id m3sm4965200ywe.90.2018.12.03.22.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 22:44:17 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Tue, 4 Dec 2018 15:46:55 +0900 Message-Id: <20181204064655.26929-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] distro: not taint environment variables if possible X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The aim of this patch is not to have temporary variables used in distro_bootcmd left as environment variables after run something. See the discussion[1]. Without this patch, saveenv command also saves those variables, too. While they are apparently safe, scsi_need_init can be harmful. Please note that, in most cases, a variable should be converted to hush's local variable, while "devplist" cannot because it is created by "part" command as an environment variable. [1] https://lists.denx.de/pipermail/u-boot/2018-December/350209.html Signed-off-by: AKASHI Takahiro --- include/config_distro_bootcmd.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 373fee78a999..979aca6475a9 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -27,7 +27,7 @@ #define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \ "if " #devtypel " dev ${devnum}; then " \ - "setenv devtype " #devtypel "; " \ + "devtype=" #devtypel "; " \ "run scan_dev_for_boot_part; " \ "fi\0" @@ -37,7 +37,7 @@ #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \ "bootcmd_" #devtypel #instance "=" \ - "setenv devnum " #instance "; " \ + "devnum=" #instance "; " \ "run " #devtypel "_boot\0" #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \ @@ -77,7 +77,7 @@ "if ubi part ${bootubipart} && " \ "ubifsmount ubi${devnum}:${bootubivol}; " \ "then " \ - "setenv devtype ubi; " \ + "devtype=ubi; " \ "run scan_dev_for_boot; " \ "fi\0" #define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV @@ -180,11 +180,11 @@ #ifdef CONFIG_SCSI #define BOOTENV_RUN_SCSI_INIT "run scsi_init; " -#define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; " +#define BOOTENV_SET_SCSI_NEED_INIT "scsi_need_init=; " #define BOOTENV_SHARED_SCSI \ "scsi_init=" \ "if ${scsi_need_init}; then " \ - "setenv scsi_need_init false; " \ + "scsi_need_init=false; " \ "scsi scan; " \ "fi\0" \ \ @@ -404,7 +404,8 @@ "bootfstype; then " \ "run scan_dev_for_boot; " \ "fi; " \ - "done\0" \ + "done; " \ + "setenv devplist\0" \ \ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ \