lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Oct 2019 16:28:47 +0000
From:   Song Liu <songliubraving@...com>
To:     Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>
CC:     "shuah@...nel.org" <shuah@...nel.org>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: correct path to include msg +
 path



> On Oct 2, 2019, at 5:04 AM, Ivan Khoronzhuk <ivan.khoronzhuk@...aro.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@...aro.org>


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ