Message ID | 20240318231640.1343956-1-caleb.connolly@linaro.org |
---|---|
State | Accepted |
Commit | ae8e1d5aa46034963bca28fb07dac76970f718fe |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1669422wrs; Mon, 18 Mar 2024 16:16:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXFk7oZmVOQh0jN2fPoFyZCEnuc5QV8Z53Fe0qYJnRm/+o4Y7t2SK4kuuprmfwQRFukkwGtgVEFcHL/bcd/VwnV X-Google-Smtp-Source: AGHT+IElFhVcERDJyl/cPIGyt7ioc3NAooHZ7S7vGr8STl114XmT5nreFtUQ8MIpKH4dxhHBXr2O X-Received: by 2002:a05:600c:474e:b0:412:c809:5421 with SMTP id w14-20020a05600c474e00b00412c8095421mr10766742wmo.2.1710803810839; Mon, 18 Mar 2024 16:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710803810; cv=none; d=google.com; s=arc-20160816; b=QRrHo3Txj5LWmHd0jo7Q+DkxIR/0C7X3DvMSGVniS1EpUdApSMHpyvvFBgk5v7mN8x POJcaM3k43eIZunonjtIT4Vmvz+kDRcfnpBiB1Q8Yvv2tHfNy/AYl8iOGn/Ld+IMpfOu W/nebKl63/hm6eZPg/jb2Afn5TbeqjPXJJ3HG3xwvREtocg60hb8yB27jqBZRy7lT2P0 zltiJ7pZm48S7zaeW4USxgdPRKApllxm6lDusf+j0TctLn4fz/f3XYFsiQOu5z0vhWZs s3QxlRoPQ7DfUfPlQbEgARQipnP2gv+cwDVjgL+YddRFKeqw6yjzlphVvGt2xeb6fEgA NTWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=c6ZM15uUUmha+RGseHVO/OgEFs12byEfeMOHHIk+r8s=; fh=qNS6Jr1xiXC/aiRs1SRrKXz3QkYbDSqznJdP39MztIo=; b=Ey92LI4trVc8rtLrXrtKJkxq3uXvnCZ0aQ7eoQze5CY6HQNVjtg1ZAFZBJbZQqbWzP za7ixP5J81sk6cZkJ1yy/Q67qKL1idwwexT20X81ty7YXvgjsDrfapSKUrOmYwxOXeCB Otsz+ENJuJ7H1H39dDECWBf013RZtYEq0hju0IEUv+SYXgP6DB6b0hZicNbxzPXtpCls vLqQDXIbYSMnOyVLe/wJ//6ZawB5yhJ3mxVnjupcJI4q7G6G2sDH3y3w1+pJWtDGdKQe vr8A3a9LN46QXNXnz6iAG01FAtEea6HY2RQnyboVlAYnZc2RfwFyBSqltmsqqaH+7ocA BwPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wirno5pJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <u-boot-bounces@lists.denx.de> Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id b27-20020a05600c4a9b00b00413f6284b51si5367610wmp.94.2024.03.18.16.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wirno5pJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A808387BC9; Tue, 19 Mar 2024 00:16:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wirno5pJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFE5E87D09; Tue, 19 Mar 2024 00:16:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 E0AF987861 for <u-boot@lists.denx.de>; Tue, 19 Mar 2024 00:16:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-413f4cb646dso31892955e9.1 for <u-boot@lists.denx.de>; Mon, 18 Mar 2024 16:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710803806; x=1711408606; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=c6ZM15uUUmha+RGseHVO/OgEFs12byEfeMOHHIk+r8s=; b=Wirno5pJP2lkHL/f94E1riLiIRZ1jeQQprrQ6Q/f4P6fmAwtWvgFKC3P63ArGSUYWI 8PkQV1G9tvau07sty8ALQR1NkZmnrfRSpbMj/TgqcJwkOHFjEvxu3dDYzdSv/S3zNAvP eQBlp4Ah1g649oPmenpMF/u8/89/UxE0B88C2bizy3iWxk/sgwjog8L/eMuiBus+5Jcl ZZI7zB9l//rdQQKOJz17mGWTRFKQ4muNbyW+cgLwwHl4/fgnBQTI9khIy2thQKiX67rj 1yD00zi+ZueG5aAxLHn5jUzx/cnU16jdeWXkErrV+iAps2FfqOY9BLx7p8enY/bbO/1I WiKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710803806; x=1711408606; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c6ZM15uUUmha+RGseHVO/OgEFs12byEfeMOHHIk+r8s=; b=sUsxtvWshWe5HLAhpyHnGwc3ZXhA/PAKmlXSQvW7w16X1quxspabQ4MaxEGaHg34SB CJEz40mzjekH177EQgQGhPdrq1AdHAAxh/cPb2VS8k1A5OzTIUpVJJWOZCSj7+4e9vVq gBSs29a1nx49B4fQpZhfvTpj+dW6RGvCfHptMnP4pcQ2fBhPP+XuMeiYwnZNt39gp82o Sl9tjaZXEqZfU9JuSk6Vs4Sx4L19nse17b0NTlER1CZ/9N0bWTL2FHMg7iJTEfa770Lq wa+Li7q8hU5rREURl7YPGbjVXbt2e0WInBf6nckyHvbI8HEZzabXe2lZyWQYz3LLhviB n35Q== X-Gm-Message-State: AOJu0YxIxAkLRYqDFb8loNfnGZuAtnkXrgCs9av9m39L/h1uQ6Ml4E0q 9+EP3SWuIAYjyyIxYV+RS9Cdw9k0XrXXDIJ9p5TAfLeA5Lywyz/WAbc/9Heua2k= X-Received: by 2002:a05:600c:a02:b0:414:9fa:1da2 with SMTP id z2-20020a05600c0a0200b0041409fa1da2mr5093761wmp.15.1710803806235; Mon, 18 Mar 2024 16:16:46 -0700 (PDT) Received: from lion.caleb.rex.connolly.tech (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id v7-20020a05600c444700b0041420706396sm2646551wmn.12.2024.03.18.16.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:16:45 -0700 (PDT) From: Caleb Connolly <caleb.connolly@linaro.org> To: Caleb Connolly <caleb.connolly@linaro.org>, Patrice Chotard <patrice.chotard@foss.st.com>, Ramon Fried <rfried.dev@gmail.com>, Sean Edmond <seanedmond@microsoft.com>, Tom Rini <trini@konsulko.com> Cc: u-boot@lists.denx.de Subject: [PATCH] cmd: sysboot: null check filename Date: Mon, 18 Mar 2024 23:16:36 +0000 Message-ID: <20240318231640.1343956-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean |
Series |
cmd: sysboot: null check filename
|
expand
|
On Mon, 18 Mar 2024 23:16:36 +0000, Caleb Connolly wrote: > Currently if ${bootfile} is unset and sysboot is invoked with no > filename specified then U-Boot will crash will a null-pointer > dereference. Add the missing check and a matching error print. > > Applied to u-boot/master, thanks!
diff --git a/cmd/sysboot.c b/cmd/sysboot.c index 63a7806debe4..d14c570d96ab 100644 --- a/cmd/sysboot.c +++ b/cmd/sysboot.c @@ -76,8 +76,12 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc, } if (argc < 6) { filename = env_get("bootfile"); + if (!filename) { + printf("Specify a filename or set the ${bootfile} environment variable\n"); + return 1; + } } else { filename = argv[5]; env_set("bootfile", filename); }
Currently if ${bootfile} is unset and sysboot is invoked with no filename specified then U-Boot will crash will a null-pointer dereference. Add the missing check and a matching error print. Fixes: 993c912d304d ("cmd: sysboot: Create a sysboot command dedicated file") Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> --- cmd/sysboot.c | 4 ++++ 1 file changed, 4 insertions(+)