netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Cc: "shuah@kernel.org" <shuah@kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	Martin Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: correct path to include msg + path
Date: Wed, 2 Oct 2019 16:28:47 +0000	[thread overview]
Message-ID: <CB640650-0E50-49DA-8264-9C02D5B1A7A2@fb.com> (raw)
In-Reply-To: <20191002120404.26962-3-ivan.khoronzhuk@linaro.org>



> On Oct 2, 2019, at 5:04 AM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> wrote:
> 
> The "path" buf is supposed to contain path + printf msg up to 24 bytes.
> It will be cut anyway, but compiler generates truncation warns like:
> 
> "
> samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c: In
> function ‘setup_cgroup_environment’:
> samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:34:
> warning: ‘/cgroup.controllers’ directive output may be truncated
> writing 19 bytes into a region of size between 1 and 4097
> [-Wformat-truncation=]
> snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path);
> 				  ^~~~~~~~~~~~~~~~~~~
> samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:2:
> note: ‘snprintf’ output between 20 and 4116 bytes into a destination
> of size 4097
> snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:34:
> warning: ‘/cgroup.subtree_control’ directive output may be truncated
> writing 23 bytes into a region of size between 1 and 4097
> [-Wformat-truncation=]
> snprintf(path, sizeof(path), "%s/cgroup.subtree_control",
> 				  ^~~~~~~~~~~~~~~~~~~~~~~
> cgroup_path);
> samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:2:
> note: ‘snprintf’ output between 24 and 4120 bytes into a destination
> of size 4097
> snprintf(path, sizeof(path), "%s/cgroup.subtree_control",
> cgroup_path);
> "
> 
> In order to avoid warns, lets decrease buf size for cgroup workdir on
> 24 bytes with assumption to include also "/cgroup.subtree_control" to
> the address. The cut will never happen anyway.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>


Acked-by: Song Liu <songliubraving@fb.com> 


  reply	other threads:[~2019-10-02 16:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 12:04 [PATCH bpf-next 0/2] selftest/bpf: remove warns for enable_all_controllers Ivan Khoronzhuk
2019-10-02 12:04 ` [PATCH bpf-next 1/2] selftests/bpf: add static to enable_all_controllers() Ivan Khoronzhuk
2019-10-02 16:26   ` Song Liu
2019-10-02 12:04 ` [PATCH bpf-next 2/2] selftests/bpf: correct path to include msg + path Ivan Khoronzhuk
2019-10-02 16:28   ` Song Liu [this message]
2019-10-03 15:39 ` [PATCH bpf-next 0/2] selftest/bpf: remove warns for enable_all_controllers Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CB640650-0E50-49DA-8264-9C02D5B1A7A2@fb.com \
    --to=songliubraving@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ivan.khoronzhuk@linaro.org \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=yhs@fb.com \
    --subject='Re: [PATCH bpf-next 2/2] selftests/bpf: correct path to include msg + path' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).