Skip to content

Commit

Permalink
kselftest/cgroup: fix a signedness bug
Browse files Browse the repository at this point in the history
"len" needs to be signed for the error handling to work.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Shuah Khan (Samsung OSG) <[email protected]>
  • Loading branch information
Dan Carpenter authored and Shuah Khan (Samsung OSG) committed Jun 7, 2018
1 parent 9855c46 commit 53c3daf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/cgroup/cgroup_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 53c3daf

Please sign in to comment.