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!
next prev parent reply other threads:[~2018-06-07 12:52 UTC|newest]
Thread overview: 3+ 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 12:52 ` Roman Gushchin [this message]
2018-06-07 19:46 ` Shuah Khan
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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox