All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] kselftest/cgroup: fix a signedness bug
Date: Thu, 07 Jun 2018 12:52:27 +0000	[thread overview]
Message-ID: <20180607125224.GA4302@castle> (raw)
In-Reply-To: <20180607083001.m4z4wjev6j3sc423@kili.mountain>

On Thu, Jun 07, 2018 at 11:30:02AM +0300, Dan Carpenter wrote:
> "len" needs to be signed for the error handling to work.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index b69bdeb4b9fe..1e9e3c470561 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -35,7 +35,7 @@ static ssize_t read_text(const char *path, char *buf, size_t max_len)
>  	return len;
>  }
>  
> -static ssize_t write_text(const char *path, char *buf, size_t len)
> +static ssize_t write_text(const char *path, char *buf, ssize_t len)
>  {
>  	int fd;
>  
> @@ -140,7 +140,7 @@ long cg_read_key_long(const char *cgroup, const char *control, const char *key)
>  int cg_write(const char *cgroup, const char *control, char *buf)
>  {
>  	char path[PATH_MAX];
> -	size_t len = strlen(buf);
> +	ssize_t len = strlen(buf);
>  
>  	snprintf(path, sizeof(path), "%s/%s", cgroup, control);
>  

Looks good to me!

Thanks!

WARNING: multiple messages have this Message-ID (diff)
From: guro at fb.com (Roman Gushchin)
Subject: [PATCH] kselftest/cgroup: fix a signedness bug
Date: Thu, 7 Jun 2018 13:52:27 +0100	[thread overview]
Message-ID: <20180607125224.GA4302@castle> (raw)
In-Reply-To: <20180607083001.m4z4wjev6j3sc423@kili.mountain>

On Thu, Jun 07, 2018 at 11:30:02AM +0300, Dan Carpenter wrote:
> "len" needs to be signed for the error handling to work.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index b69bdeb4b9fe..1e9e3c470561 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -35,7 +35,7 @@ static ssize_t read_text(const char *path, char *buf, size_t max_len)
>  	return len;
>  }
>  
> -static ssize_t write_text(const char *path, char *buf, size_t len)
> +static ssize_t write_text(const char *path, char *buf, ssize_t len)
>  {
>  	int fd;
>  
> @@ -140,7 +140,7 @@ long cg_read_key_long(const char *cgroup, const char *control, const char *key)
>  int cg_write(const char *cgroup, const char *control, char *buf)
>  {
>  	char path[PATH_MAX];
> -	size_t len = strlen(buf);
> +	ssize_t len = strlen(buf);
>  
>  	snprintf(path, sizeof(path), "%s/%s", cgroup, control);
>  

Looks good to me!

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: guro@fb.com (Roman Gushchin)
Subject: [PATCH] kselftest/cgroup: fix a signedness bug
Date: Thu, 7 Jun 2018 13:52:27 +0100	[thread overview]
Message-ID: <20180607125224.GA4302@castle> (raw)
Message-ID: <20180607125227.St2nVTQMHPYVDP-a-mtf9QYKbeJd0wQjocHqtW1X1IA@z> (raw)
In-Reply-To: <20180607083001.m4z4wjev6j3sc423@kili.mountain>

On Thu, Jun 07, 2018@11:30:02AM +0300, Dan Carpenter wrote:
> "len" needs to be signed for the error handling to work.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index b69bdeb4b9fe..1e9e3c470561 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -35,7 +35,7 @@ static ssize_t read_text(const char *path, char *buf, size_t max_len)
>  	return len;
>  }
>  
> -static ssize_t write_text(const char *path, char *buf, size_t len)
> +static ssize_t write_text(const char *path, char *buf, ssize_t len)
>  {
>  	int fd;
>  
> @@ -140,7 +140,7 @@ long cg_read_key_long(const char *cgroup, const char *control, const char *key)
>  int cg_write(const char *cgroup, const char *control, char *buf)
>  {
>  	char path[PATH_MAX];
> -	size_t len = strlen(buf);
> +	ssize_t len = strlen(buf);
>  
>  	snprintf(path, sizeof(path), "%s/%s", cgroup, control);
>  

Looks good to me!

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-06-07 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07  8:30 [PATCH] kselftest/cgroup: fix a signedness bug Dan Carpenter
2018-06-07  8:30 ` Dan Carpenter
2018-06-07  8:30 ` dan.carpenter
2018-06-07 12:52 ` Roman Gushchin [this message]
2018-06-07 12:52   ` Roman Gushchin
2018-06-07 12:52   ` guro
2018-06-07 19:46   ` Shuah Khan
2018-06-07 19:46     ` Shuah Khan
2018-06-07 19:46     ` shuah

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=20180607125224.GA4302@castle \
    --to=guro@fb.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.