Message ID | 20240705065434.3608030-3-dominique.martinet@atmark-techno.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCWIVBV7SUGRBONRT22AMGQEIABK2DY@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=QKMgFadA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::f3c; helo=mail-qv1-xf3c.google.com; envelope-from=swupdate+bncbcwivbv7sugrbonrt22amgqeiabk2dy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-qv1-xf3c.google.com (mail-qv1-xf3c.google.com [IPv6:2607:f8b0:4864:20::f3c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WFklw3G6zz1xr0 for <incoming@patchwork.ozlabs.org>; Fri, 5 Jul 2024 16:54:52 +1000 (AEST) Received: by mail-qv1-xf3c.google.com with SMTP id 6a1803df08f44-6b5ebf8a8f3sf17451236d6.3 for <incoming@patchwork.ozlabs.org>; Thu, 04 Jul 2024 23:54:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720162490; cv=pass; d=google.com; s=arc-20160816; b=SQalTt9OShRgnutoL5y8xgevmyrSsXvGCoZpIWtV4RnY5p4nXEacQNMeiS5u46luIX NJkFnTMHBSTc4u9Bqhbgc3jAJc1WdxJaxabO5rIvdfUz1ugQKNk9B/dW0uap9ByfN1j9 06gTlPK7lLUHHrmCeGMyo7ScvZiecMRxyfViT0CC4/g1KUO0/CPaPMLbVL2XxLNtpnco /Bf6+b96/X3nfTY/Or4gB9GVcX5z6lZLll2j+9Y07G6WXh42QwTKaaGdAju5VYDvsAYZ Jbq6u8vhf7JSCk7/iLEy6azPDy0YeTuGC5FNVe4MtbqTjETqpmi7aUdeWFtNLjscolZ4 y5Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=+At9LjHaD0WW5CtUCSClsUtPdm0wbNJX3efT6gxgbYs=; fh=VkblWxYYZcuD2+TfvKVyYWyFFcNJnhNC69K6zucvXo0=; b=SxD7JZMBZyJBw+zuCzE5265j2fhZvqfG4t88BBpizqxb3D3thkWBT8+b3hrDOaNDd+ quSRWbtv2FhI7NDr6Q+ateZjurovkvUA1r6FXebs8dZckf0ge7svrJgxHQ7FhSkp4SnS k0QYcT8hJwtf7ndCcKSTF/+MlFyFVCl7PbTS++bnMkCaHoqpsidP0652L5Ptrcx2tl5S HLPrwq9Bbq2+wNG8Ga+WQfG2XlrIEE3hICc3645V/K4blW6fuvP8EgNrTPuIspWmvZbn 4HC4FftSU169pKve0+gVu6crUgqyGsj2sUgNlYL0cG/M6AItJ4JqnOfxflKINYA7wKWf oeAQ==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=EwF9Oa72; dkim=pass header.i=@atmark-techno.com header.s=google header.b=RvaqKZgE; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1720162490; x=1720767290; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=+At9LjHaD0WW5CtUCSClsUtPdm0wbNJX3efT6gxgbYs=; b=QKMgFadAz3NRjVshV5XdP3sK8O/zhhO4eJJEKH3A3/TWUKeMlgwxvvTFp+zJaOWrjA lbsPXfhsK9lU9s+kbqo/Mke4x+5XGj2YaDwKHnsZgEEPEEd06bSBrIyzAEr1Q+MVt/cB XdVVnTeFZR2AT+ssrMCwC8ObNUvuDVAoKqBa11+cdxb9Ekz80Wc0X4As64HJBD6hn4Dd ibE+qvZmRJxWVHuaN3je3wddDcgp2RAs2bvgjUAad9s5ILJ2SWiZT1lp61j60zbvz7B0 a4eh41DpNaltUTeQpufrxAntc3aFxJhdnAxd0ll4hWffZjjsesfzWkBri9CwgAuLZTFl eD7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720162490; x=1720767290; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=+At9LjHaD0WW5CtUCSClsUtPdm0wbNJX3efT6gxgbYs=; b=pViCKSlQwRdD4CB1U43XHS8uKVcjfoLDXJvrobwUIIlqzgycTdHTioG1mAbT0g7WBm Dye/wvoBaQ0H4otJjmuDfGz/dRswMjuzfpUjrc6n9OsGqPkKF/VUbIWP6hLxUe0SDCkr XC2JDtTtR8k5iNO0dBa/qjN3kQAiYJLFi/JyhyJPDRPQjIbtOXu3MD9OyorZjEr9jjDb Qb+gf7Vx48AxLHedIxPSMasZyGWSN4UXKTiZHKNwRTQPy/Pu4gKXGl+h6DEcH4QoPpUU s0k7py8l4AaH9bYh55wsNrGYOpsARwZGIkRbnoRy2QMPK3+fzM3qfmHw4NDcOZQ5CQAg lHpQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWLUM2tqXsa+bGesoKQgBV0VDFW+MYmhIP7Zi6469uDALd4x2MNYMMLqAOEr4GO7Tu7ar66czp+e6wt8wCRK6KcdljPs0v5vZjAdm2U2g== X-Gm-Message-State: AOJu0Yy/iVdG0cXnV7Nov9h6dpDdFkp1EEv+3bM//hAEXJkWmiDjLXG7 nmpOxC/INoWH6r92pDamj40LgYXsOnEhKBRjWbTTJFYBFXXGKk32 X-Google-Smtp-Source: AGHT+IEwQqfR8Bxs99cnFMlIsarEFh0Q21UILJOtlI5n5VBgA/NcnffXENhok+vIq6CBQekaWHIVDQ== X-Received: by 2002:a05:6214:c84:b0:6b5:e665:7f7 with SMTP id 6a1803df08f44-6b5ecf8ed45mr39161096d6.9.1720162489773; Thu, 04 Jul 2024 23:54:49 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6214:5189:b0:6ab:8f81:8496 with SMTP id 6a1803df08f44-6b5ea7f4516ls19061576d6.2.-pod-prod-01-us; Thu, 04 Jul 2024 23:54:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVUHZEtn2bSbEIsawS5grD29jFMPji4fQpuPCFmwZzq0g9y4Bv9rwHNDv72vCvJPv7GCHotZYXsEcpZuKaObuP6qA74S6BNR7NS X-Received: by 2002:a05:6214:226b:b0:6b5:655b:99be with SMTP id 6a1803df08f44-6b5ed03fb0cmr44368146d6.43.1720162488626; Thu, 04 Jul 2024 23:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720162488; cv=none; d=google.com; s=arc-20160816; b=iXf7NKnoZyFQbY7M5Wl9BK0TgZ8NhXAOqA+TJdAdfEoCXxxI/oF7wMq44D4hJj9BWk JfHrJ3PQ9cdKE2PFPK/duWsEU6Vq1Pp86KGnXKJAa0ECA6aRXXK3v7nkp2MBcEIFrMad fHpS7Eiy7RjqpZ0ecL3qzlqOj/EWB7d20l2B3p3rCtAJSfjAKw23mCFWvlZZbvULL4hW dhko16VhjGliU5Hv5RXL9QoZwIIqSrH6movvRk1lLglsL0CNffkTOBYdE3aCt0rbp89y M20aPhs2Qkp4Yj/uJJtY8hd69XMQ6ou2PFa4QVZW8GOMdxpGT4cpAwGwnLgm1eTZ7JJl I3Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=wZdWroxtdEJhdLlLlpjDSjk02E+Tkfd3qYC/sYk08uw=; fh=ZBGXGsBLpJh5ScVbXUfrQqBXPCosxA39YywO1L2sf8c=; b=xaacVZ6vLPSzf4w7aboGyyc3JdkdcKkThTFY1q7UD77ZbOqoRdWhanPdk37cqxy81x jhLW8k3Q1l9+vHToxVhllrd2y79G1vnX92pHiC5y+cWKv/3LcPmOcj6ti98K7I8VWm3s n/dTnGrsXUv/hgWru30/vz/KD1xuH/6/hyoOog52g8v9XoMhAqlakSkb+UryN9b3FaLv mliQ9Q32tvkq9kMr3yUTJL5DRgHzjZEdX+Z2cPsQ9+yJ7GdW3vyf17wOt4XFFZbD/ekh JJNaRbH4O42ESNZeRC/kBwh/34AEUiH/A5L7nfOU4E0BsCqLzfNpj/1zpFdkeDsiJBpJ b/aA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=EwF9Oa72; dkim=pass header.i=@atmark-techno.com header.s=google header.b=RvaqKZgE; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTPS id 6a1803df08f44-6b5ddfe5436si2823576d6.4.2024.07.04.23.54.48 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 23:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 1C7A49B5 for <swupdate@googlegroups.com>; Fri, 5 Jul 2024 15:54:46 +0900 (JST) Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id D14B4A22 for <swupdate@googlegroups.com>; Fri, 5 Jul 2024 15:54:44 +0900 (JST) Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3d9196425fdso612135b6e.2 for <swupdate@googlegroups.com>; Thu, 04 Jul 2024 23:54:44 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVLLSvEqnBxMXxXOHrSPuhld0xA9f6F0CEUMTmls15SnLkmwAnrK0Ln1VvRz+kW1r6rnw1QGmFsRn4pzG1+MyMkIRuJcC2F/Pqx X-Received: by 2002:a05:6808:1391:b0:3d5:5fbe:b2fa with SMTP id 5614622812f47-3d914c9820cmr3770994b6e.35.1720162483467; Thu, 04 Jul 2024 23:54:43 -0700 (PDT) X-Received: by 2002:a05:6808:1391:b0:3d5:5fbe:b2fa with SMTP id 5614622812f47-3d914c9820cmr3770980b6e.35.1720162483034; Thu, 04 Jul 2024 23:54:43 -0700 (PDT) Received: from pc-0182.atmarktech (103.131.189.35.bc.googleusercontent.com. [35.189.131.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080498a3besm13295907b3a.196.2024.07.04.23.54.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2024 23:54:42 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from <dominique.martinet@atmark-techno.com>) id 1sPcq9-00F8cO-0x; Fri, 05 Jul 2024 15:54:41 +0900 From: Dominique Martinet <dominique.martinet@atmark-techno.com> To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: Dominique Martinet <dominique.martinet@atmark-techno.com> Subject: [swupdate] [PATCH 2/5] swupdate_vars: check namespace init worked Date: Fri, 5 Jul 2024 15:54:31 +0900 Message-Id: <20240705065434.3608030-3-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240705065434.3608030-1-dominique.martinet@atmark-techno.com> References: <20240705065434.3608030-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=EwF9Oa72; dkim=pass header.i=@atmark-techno.com header.s=google header.b=RvaqKZgE; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series | misc fixes | expand |
On 05.07.24 08:54, Dominique Martinet wrote: > if the fw_env config didn't contain the requested namespace (or config > was invalid) then libuboot_get_namespace() will fail and that will > segfault swupdate > > This is an admin error so not a critical bug, but might as well > check and print an error. > > Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> > --- > core/swupdate_vars.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/core/swupdate_vars.c b/core/swupdate_vars.c > index f1e536a845be..081e6097e1e2 100644 > --- a/core/swupdate_vars.c > +++ b/core/swupdate_vars.c > @@ -47,6 +47,10 @@ int swupdate_vars_initialize(struct uboot_ctx **ctx, const char *namespace) > } > > *ctx = libuboot_get_namespace(*ctx, namespace); > + if (!*ctx) { > + ERROR("Cannot get namespace %s from %s", namespace, get_fwenv_config()); > + return -EINVAL; > + } > > if (libuboot_open(*ctx) < 0) { > WARN("Cannot read environment, maybe still empty ?"); Thanks, I forget to check it when I added this code ! Acked-by: Stefano Babic <stefano.babic@swupdate.org> Best regards, Stefano
diff --git a/core/swupdate_vars.c b/core/swupdate_vars.c index f1e536a845be..081e6097e1e2 100644 --- a/core/swupdate_vars.c +++ b/core/swupdate_vars.c @@ -47,6 +47,10 @@ int swupdate_vars_initialize(struct uboot_ctx **ctx, const char *namespace) } *ctx = libuboot_get_namespace(*ctx, namespace); + if (!*ctx) { + ERROR("Cannot get namespace %s from %s", namespace, get_fwenv_config()); + return -EINVAL; + } if (libuboot_open(*ctx) < 0) { WARN("Cannot read environment, maybe still empty ?");
if the fw_env config didn't contain the requested namespace (or config was invalid) then libuboot_get_namespace() will fail and that will segfault swupdate This is an admin error so not a critical bug, but might as well check and print an error. Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- core/swupdate_vars.c | 4 ++++ 1 file changed, 4 insertions(+)