Message ID | 20220530060304.1296389-2-dominique.martinet@atmark-techno.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCWIVBV7SUGRBJN42GKAMGQEAKI6LGI@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=biSV9xXk; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::d3e; helo=mail-io1-xd3e.google.com; envelope-from=swupdate+bncbcwivbv7sugrbjn42gkamgqeaki6lgi@googlegroups.com; receiver=<UNKNOWN>) Received: from mail-io1-xd3e.google.com (mail-io1-xd3e.google.com [IPv6:2607:f8b0:4864:20::d3e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LBPwS6D1nz9s0r for <incoming@patchwork.ozlabs.org>; Mon, 30 May 2022 16:03:19 +1000 (AEST) Received: by mail-io1-xd3e.google.com with SMTP id k17-20020a5d9d51000000b006653f2bc513sf5031435iok.10 for <incoming@patchwork.ozlabs.org>; Sun, 29 May 2022 23:03:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653890597; cv=pass; d=google.com; s=arc-20160816; b=k0D69W2SURlspwdWTibx6EfCQdqxcF0Vpl2AYGgWLr7rPbjc2LEOoNtY4XXr9hjbOj dmmwqylyWKhDofXeoRUejJiz/YtY240u4vm5UrsWxg3Tay+SD0zNr7gM8FLJWSFM/Uoq f576tQOxUC81ynWJXOjgrDCGH1tbdJstpKuS0Jm97vTQBhJeo3vPM6o29/aKFGy+3lQ8 S+QtEYdfS5ARdEkf5yTj9vArCP/EFUT3PUKcXTcDqvBGeAIGq6AjbOuhnV1HSvLvQWI/ IZKLYLyOWryC519rLmkYwMCtuoCsQnbTX0pB4BXoOUri/fgYlFcAq/yudfgLT7j0fCbT bbig== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=IIooCele3+XwjU9BmmFJYbgtTUbAQN5PdWAK4NeWhlc=; b=RV6NP9ScmZZlAboc1ow5FLXAqr7Ls1oPF2ii2WwB+GaMV6DetohnwJwfMit4VSkyUV Ehzz3bf7PMQ29K4U1X5WqAmXn+luoDk/IxYUimDO9T7sdtwpLzIdNLqn14GJYmhXM3Sc 5OrrdCSkplh6a5WQvnim0JeQlGCqCw0Eey2jBtRxXWt6A8NuFbAeBeOycd6nPrRMBNhJ srDeiQgYa8UZeNzEuZnbea9ICW5nHzjAyTWmZemq2C9I9oOWC3wghC/1Up4X8ubwViZK s9QdTjNdxOqc+xUHGUuvlg5H7ZBR8jXhpfFimP6K5LEqJ1EXUu+J1f/qayytqMYSKRr1 zcxw== ARC-Authentication-Results: i=2; gmr-mx.google.com; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=IIooCele3+XwjU9BmmFJYbgtTUbAQN5PdWAK4NeWhlc=; b=biSV9xXkoSsyBJgUM2zat3rgv3mDPhxYgZxXhSrXkfvEPRlEcrWDxqeA8ocqiDcmkx q3yVndMmtdOoVttq3x5uGD1syVnTi1EqYBYU4dOwTkArG2HOIqObCnXuLdzSjhQb8f3j RmKbZEquXTEoMat7cmg3ZgJ7rdu8yxWI/Tf1rbzO0IenFLPgkPJvbgAfB+2VF3g630Aj IAyYeiyx0s4MeGiAhPlWcFiKUk9++xLzjbGIjvbF9u6u9qBu4H+C8bRbZwW88MKnafMi 1r0lH/q+bH2nulcOb0BpjwsidtXkTyXQq7Q+3AUnhvz7Z0cZnbb3V1YnlsAut5JYAOW1 PCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=IIooCele3+XwjU9BmmFJYbgtTUbAQN5PdWAK4NeWhlc=; b=4p9wW8YQTUMlZCRrw2biUjBghTS6hPXuFO4qQKylPteo8kYsPLoxOOZzTi62L4qnJf a3y5BjCP9IQwGR+P2Sv6+9r8d9JRCCb7CdUQeu4B8iDwKPUIUj0qM+sjukA06kGe/x3h lUeALapi/zjRPPAxRELw6X4L/d8h9BfUVm27rH/Sn54PjjsUsgs9ZtZ+OpS8EDggY/yy RUVcnuEi6jzWWQl3fN60+2YlZxWRMKNY8WuAz4Ko+wtUN8ZQflG6/tEFnUqIfCU7kGFq fBsezIvamD76hCswyijfjlp+AldlHnzRqVDVAD2iGg4/i/7hzEBvWb+4WqrFYad4xmbz n+UA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533Jm5uzMGv9J1qLr3mzcFQlGz9gV9csaMi8ymQjWbAecG+bnGmq zHIWzFLF+2oGtrB85aMmiQk= X-Google-Smtp-Source: ABdhPJy0ohYSJIxTjsHJbSAIgjtzeXEczcnDhrIZ2UWVbDVH0nZvYr7DlHBBhpsb8EsZ8LkRhMdlmw== X-Received: by 2002:a05:6e02:12ee:b0:2d1:7bcd:f7cd with SMTP id l14-20020a056e0212ee00b002d17bcdf7cdmr23200649iln.173.1653890597392; Sun, 29 May 2022 23:03:17 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:938c:0:b0:662:ff20:2e4c with SMTP id c12-20020a5d938c000000b00662ff202e4cls1975838iol.3.gmail; Sun, 29 May 2022 23:03:17 -0700 (PDT) X-Received: by 2002:a5d:9ed7:0:b0:65b:3312:9946 with SMTP id a23-20020a5d9ed7000000b0065b33129946mr24366805ioe.10.1653890596905; Sun, 29 May 2022 23:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653890596; cv=none; d=google.com; s=arc-20160816; b=gHrU+gVYQ7ajeJqXAgLQxw5GzqJB8BvDZ/6qb6nMLjDHsWv04AgiJR/u4MnkWBTFj+ HkJ4kOVpZtg9RdkJrKkpHS57XUW3CiI0eaqp6HH4QyzPImsO9jrL0vU2Pz9Htn9eTHZF a5tES+QYanAMNa5fyd/JqE6N1FkvoAjvk5Y9ij5q850k56uwCB4utLtd4QjqKarcMXQZ lXzq2KGRPdCIvwwyQOaqH7GPq81jrbJuZy53egzRobjO9ui+/ZvoUH9CMP2hxzK/bUgN foJETivMm/pPAsTPNaPd4B9oqp3Pk/Q0Qy6Uo12WKgOVb2g1m1i5OQ0nIUxyWRT2jevV ig2A== 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; bh=9yWZxk2kmc1WKBFrNWRZuGGswvRTL8XQ7PheAsxADgM=; b=cXSq+HMlrB8FyyNP5PixaQLoQspPNJl/Aaj0BcOnbiRnuHjyVXj9Btc4hpjjEar4n8 QvrucBaJ0kgrkUUtk8s1NnCUfIixaXj1nhMmx9X0PfHh8Eoj73aj5KycgrzzVJ1LYCgG uDzGWwv/U7WcTHrxbL5iYUloiiGTzaby1y1NdX0LKcI356Jf0YHWDEJuMXzSt0+RdhbD yqbojog8xQGX/KGoQ/Z2bDxEot2A8Qw7au6e1xkRLf0O/g2j4tj4w3ceRaMqNOTOuOH0 T/0WdBTxAnioA3nxsje9czKA2SRgf6NtL9r12yg94x90EtUXBCY32qMyJWgoC/QJFQit Ay1g== ARC-Authentication-Results: i=1; gmr-mx.google.com; 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 Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTP id l10-20020a05660227ca00b00652f6c18b70si590898ios.0.2022.05.29.23.03.16 for <swupdate@googlegroups.com>; Sun, 29 May 2022 23:03:16 -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 46C7120D6D for <swupdate@googlegroups.com>; Mon, 30 May 2022 15:03:15 +0900 (JST) Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 1877920D6D for <swupdate@googlegroups.com>; Mon, 30 May 2022 15:03:15 +0900 (JST) Received: by mail-pg1-f198.google.com with SMTP id q6-20020a635046000000b003fb882bc1d1so3576777pgl.23 for <swupdate@googlegroups.com>; Sun, 29 May 2022 23:03:15 -0700 (PDT) X-Received: by 2002:a17:902:724a:b0:163:89ee:23ea with SMTP id c10-20020a170902724a00b0016389ee23eamr17292552pll.12.1653890594194; Sun, 29 May 2022 23:03:14 -0700 (PDT) X-Received: by 2002:a17:902:724a:b0:163:89ee:23ea with SMTP id c10-20020a170902724a00b0016389ee23eamr17292534pll.12.1653890593965; Sun, 29 May 2022 23:03:13 -0700 (PDT) Received: from pc-0115 (103.131.189.35.bc.googleusercontent.com. [35.189.131.103]) by smtp.gmail.com with ESMTPSA id u16-20020a17090ae01000b001d6a79768b6sm4949633pjy.49.2022.05.29.23.03.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2022 23:03:11 -0700 (PDT) Received: from martinet by pc-0115 with local (Exim 4.95) (envelope-from <martinet@pc-0115>) id 1nvYUf-005RIC-3j; Mon, 30 May 2022 15:03:09 +0900 From: Dominique Martinet <dominique.martinet@atmark-techno.com> To: swupdate@googlegroups.com, sbabic@denx.de Cc: Dominique Martinet <dominique.martinet@atmark-techno.com> Subject: [swupdate] [PATCH 1/6] save/get_state: fix gcc warning about out of bound strnlen Date: Mon, 30 May 2022 15:02:59 +0900 Message-Id: <20220530060304.1296389-2-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220530060304.1296389-1-dominique.martinet@atmark-techno.com> References: <20220530060304.1296389-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; 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 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 |
Fix gcc warnings or -fanalyzer warnings
|
expand
|
diff --git a/core/state.c b/core/state.c index 2ec01f5d73ef..27481971a232 100644 --- a/core/state.c +++ b/core/state.c @@ -23,7 +23,7 @@ * environment/ */ #define CHECK_STATE_VAR(v) do { \ - if (strnlen(v, BOOTLOADER_VAR_LENGTH) == 0) { \ + if (v[0] == 0) { \ WARN("Update Status Storage Key " \ "is empty, setting it to 'ustate'"); \ v = (char *)"ustate"; \
We do not actually need strlen here at all, just checking the first byte for '0' is enough as strlen was only compared to 0. This fixes the following warning: In function ‘do_save_state’, inlined from ‘save_state’ at core/state.c:57:10: core/state.c:26:13: warning: ‘strnlen’ specified bound 16 exceeds source size 5 [-Wstringop-overread] 26 | if (strnlen(v, BOOTLOADER_VAR_LENGTH) == 0) { \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core/state.c:35:9: note: in expansion of macro ‘CHECK_STATE_VAR’ 35 | CHECK_STATE_VAR(key); | ^~~~~~~~~~~~~~~ In function ‘read_state’, inlined from ‘do_get_state’ at core/state.c:81:25, inlined from ‘get_state’ at core/state.c:113:10: core/state.c:26:13: warning: ‘strnlen’ specified bound 16 exceeds source size 5 [-Wstringop-overread] 26 | if (strnlen(v, BOOTLOADER_VAR_LENGTH) == 0) { \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core/state.c:63:9: note: in expansion of macro ‘CHECK_STATE_VAR’ 63 | CHECK_STATE_VAR(key); | ^~~~~~~~~~~~~~~ Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- core/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)