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] [day] [month] [year] [list]
Date:   Wed, 27 Apr 2022 06:18:42 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc:     lizefan.x@...edance.com, hannes@...xchg.org, shuah@...nel.org,
        cgroups@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, Abaci Robot <abaci@...ux.alibaba.com>
Subject: Re: [PATCH] selftests: cgroup: Fix unsigned expression compared with
 zero

On Wed, Apr 27, 2022 at 02:17:56PM +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./tools/testing/selftests/cgroup/cgroup_util.c:566:8-12: WARNING:
> Unsigned expression compared with zero: size < 0.
> 
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 2 +-
>  tools/testing/selftests/cgroup/cgroup_util.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..661e06b94a43 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -552,7 +552,7 @@ int proc_mount_contains(const char *option)
>  	return strstr(buf, option) != NULL;
>  }
>  
> -ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
> +ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, ssize_t size)

Converting input size parameter to ssize_t doesn't make sense. I don't see
where it's doing size < 0 either but that's probably where it should be
fixed.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ