All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-05 11:06 ` YueHaibing
  0 siblings, 0 replies; 10+ messages in thread
From: YueHaibing @ 2022-11-05 11:06 UTC (permalink / raw)
  To: tj, lizefan.x, hannes, shuah, yosryahmed, roman.gushchin,
	shakeelb, rientjes, akpm
  Cc: cgroups, linux-kselftest, linux-kernel, YueHaibing

'size' is unsigned, it never less than zero.

Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index 4c52cc6f2f9c..e8bbbdb77e0d 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
 ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
 {
 	char path[PATH_MAX];
+	ssize_t ret;
 
 	if (!pid)
 		snprintf(path, sizeof(path), "/proc/%s/%s",
@@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
 	else
 		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
 
-	size = read_text(path, buf, size);
-	return size < 0 ? -1 : size;
+	ret = read_text(path, buf, size);
+	return ret < 0 ? -1 : ret;
 }
 
 int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-05 11:06 ` YueHaibing
  0 siblings, 0 replies; 10+ messages in thread
From: YueHaibing @ 2022-11-05 11:06 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	hannes-druUgvl0LCNAfugRpC6u6w, shuah-DgEjT+Ai2ygdnm+yROfE0A,
	yosryahmed-hpIqsD4AKlfQT0dZR+AlfA,
	roman.gushchin-fxUVXftIFDnyG1zEObXtfA,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA, rientjes-hpIqsD4AKlfQT0dZR+AlfA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, YueHaibing

'size' is unsigned, it never less than zero.

Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
Signed-off-by: YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index 4c52cc6f2f9c..e8bbbdb77e0d 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
 ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
 {
 	char path[PATH_MAX];
+	ssize_t ret;
 
 	if (!pid)
 		snprintf(path, sizeof(path), "/proc/%s/%s",
@@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
 	else
 		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
 
-	size = read_text(path, buf, size);
-	return size < 0 ? -1 : size;
+	ret = read_text(path, buf, size);
+	return ret < 0 ? -1 : ret;
 }
 
 int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-05 22:29   ` Yosry Ahmed
  0 siblings, 0 replies; 10+ messages in thread
From: Yosry Ahmed @ 2022-11-05 22:29 UTC (permalink / raw)
  To: YueHaibing
  Cc: tj, lizefan.x, hannes, shuah, roman.gushchin, shakeelb, rientjes,
	akpm, cgroups, linux-kselftest, linux-kernel

On Sat, Nov 5, 2022 at 4:06 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> 'size' is unsigned, it never less than zero.
>
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Thanks for fixing this!
FWIW,

Reviewed-by: Yosry Ahmed <yosryahmed@google.com>




> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>         char path[PATH_MAX];
> +       ssize_t ret;
>
>         if (!pid)
>                 snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>         else
>                 snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>
> -       size = read_text(path, buf, size);
> -       return size < 0 ? -1 : size;
> +       ret = read_text(path, buf, size);
> +       return ret < 0 ? -1 : ret;
>  }
>
>  int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-05 22:29   ` Yosry Ahmed
  0 siblings, 0 replies; 10+ messages in thread
From: Yosry Ahmed @ 2022-11-05 22:29 UTC (permalink / raw)
  To: YueHaibing
  Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	hannes-druUgvl0LCNAfugRpC6u6w, shuah-DgEjT+Ai2ygdnm+yROfE0A,
	roman.gushchin-fxUVXftIFDnyG1zEObXtfA,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA, rientjes-hpIqsD4AKlfQT0dZR+AlfA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sat, Nov 5, 2022 at 4:06 AM YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> wrote:
>
> 'size' is unsigned, it never less than zero.
>
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Thanks for fixing this!
FWIW,

Reviewed-by: Yosry Ahmed <yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>




> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>         char path[PATH_MAX];
> +       ssize_t ret;
>
>         if (!pid)
>                 snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>         else
>                 snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>
> -       size = read_text(path, buf, size);
> -       return size < 0 ? -1 : size;
> +       ret = read_text(path, buf, size);
> +       return ret < 0 ? -1 : ret;
>  }
>
>  int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-08  1:00   ` Roman Gushchin
  0 siblings, 0 replies; 10+ messages in thread
From: Roman Gushchin @ 2022-11-08  1:00 UTC (permalink / raw)
  To: YueHaibing
  Cc: tj, lizefan.x, hannes, shuah, yosryahmed, shakeelb, rientjes,
	akpm, cgroups, linux-kselftest, linux-kernel

On Sat, Nov 05, 2022 at 07:06:11PM +0800, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>  	char path[PATH_MAX];
> +	ssize_t ret;
>  
>  	if (!pid)
>  		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>  	else
>  		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>  
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>  }

Indeed, good catch!

Acked-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-08  1:00   ` Roman Gushchin
  0 siblings, 0 replies; 10+ messages in thread
From: Roman Gushchin @ 2022-11-08  1:00 UTC (permalink / raw)
  To: YueHaibing
  Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan.x-EC8Uxl6Npydl57MIdRCFDg,
	hannes-druUgvl0LCNAfugRpC6u6w, shuah-DgEjT+Ai2ygdnm+yROfE0A,
	yosryahmed-hpIqsD4AKlfQT0dZR+AlfA,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA, rientjes-hpIqsD4AKlfQT0dZR+AlfA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sat, Nov 05, 2022 at 07:06:11PM +0800, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>  	char path[PATH_MAX];
> +	ssize_t ret;
>  
>  	if (!pid)
>  		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>  	else
>  		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>  
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>  }

Indeed, good catch!

Acked-by: Roman Gushchin <roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
  2022-11-05 11:06 ` YueHaibing
@ 2022-11-08  6:29   ` Mukesh Ojha
  -1 siblings, 0 replies; 10+ messages in thread
From: Mukesh Ojha @ 2022-11-08  6:29 UTC (permalink / raw)
  To: YueHaibing, tj, lizefan.x, hannes, shuah, yosryahmed,
	roman.gushchin, shakeelb, rientjes, akpm
  Cc: cgroups, linux-kselftest, linux-kernel

Hi,

On 11/5/2022 4:36 PM, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

LGTM.
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh
> ---
>   tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>   ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>   {
>   	char path[PATH_MAX];
> +	ssize_t ret;
>   
>   	if (!pid)
>   		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>   	else
>   		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>   
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>   }
>   
>   int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-08  6:29   ` Mukesh Ojha
  0 siblings, 0 replies; 10+ messages in thread
From: Mukesh Ojha @ 2022-11-08  6:29 UTC (permalink / raw)
  To: YueHaibing, tj, lizefan.x, hannes, shuah, yosryahmed,
	roman.gushchin, shakeelb, rientjes, akpm
  Cc: cgroups, linux-kselftest, linux-kernel

Hi,

On 11/5/2022 4:36 PM, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

LGTM.
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh
> ---
>   tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>   ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>   {
>   	char path[PATH_MAX];
> +	ssize_t ret;
>   
>   	if (!pid)
>   		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>   	else
>   		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>   
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>   }
>   
>   int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-08 13:24   ` Kamalesh Babulal
  0 siblings, 0 replies; 10+ messages in thread
From: Kamalesh Babulal @ 2022-11-08 13:24 UTC (permalink / raw)
  To: YueHaibing, tj, lizefan.x, hannes, shuah, yosryahmed,
	roman.gushchin, shakeelb, rientjes, akpm
  Cc: cgroups, linux-kselftest, linux-kernel



On 11/5/22 16:36, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>

> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>  	char path[PATH_MAX];
> +	ssize_t ret;
>  
>  	if (!pid)
>  		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>  	else
>  		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>  
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>  }
>  
>  int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)

-- 
Thanks,
Kamalesh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero
@ 2022-11-08 13:24   ` Kamalesh Babulal
  0 siblings, 0 replies; 10+ messages in thread
From: Kamalesh Babulal @ 2022-11-08 13:24 UTC (permalink / raw)
  To: YueHaibing, tj-DgEjT+Ai2ygdnm+yROfE0A,
	lizefan.x-EC8Uxl6Npydl57MIdRCFDg, hannes-druUgvl0LCNAfugRpC6u6w,
	shuah-DgEjT+Ai2ygdnm+yROfE0A, yosryahmed-hpIqsD4AKlfQT0dZR+AlfA,
	roman.gushchin-fxUVXftIFDnyG1zEObXtfA,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA, rientjes-hpIqsD4AKlfQT0dZR+AlfA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA



On 11/5/22 16:36, YueHaibing wrote:
> 'size' is unsigned, it never less than zero.
> 
> Fixes: 6c26df84e1f2 ("selftests: cgroup: return -errno from cg_read()/cg_write() on failure")
> Signed-off-by: YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Reviewed-by: Kamalesh Babulal <kamalesh.babulal-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

> ---
>  tools/testing/selftests/cgroup/cgroup_util.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 4c52cc6f2f9c..e8bbbdb77e0d 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -555,6 +555,7 @@ int proc_mount_contains(const char *option)
>  ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
>  {
>  	char path[PATH_MAX];
> +	ssize_t ret;
>  
>  	if (!pid)
>  		snprintf(path, sizeof(path), "/proc/%s/%s",
> @@ -562,8 +563,8 @@ ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t
>  	else
>  		snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
>  
> -	size = read_text(path, buf, size);
> -	return size < 0 ? -1 : size;
> +	ret = read_text(path, buf, size);
> +	return ret < 0 ? -1 : ret;
>  }
>  
>  int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)

-- 
Thanks,
Kamalesh

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-08 13:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 11:06 [PATCH] selftests: cgroup: Fix unsigned comparison with less than zero YueHaibing
2022-11-05 11:06 ` YueHaibing
2022-11-05 22:29 ` Yosry Ahmed
2022-11-05 22:29   ` Yosry Ahmed
2022-11-08  1:00 ` Roman Gushchin
2022-11-08  1:00   ` Roman Gushchin
2022-11-08  6:29 ` Mukesh Ojha
2022-11-08  6:29   ` Mukesh Ojha
2022-11-08 13:24 ` Kamalesh Babulal
2022-11-08 13:24   ` Kamalesh Babulal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.