Skip to content

Commit a74c084

Browse files
committed
Fix a few sizeof style issues
Reported by kernel's checkpatch.pl script.
1 parent 7f2b636 commit a74c084

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

count.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
7777
/* Initialize it. */
7878
struct itimerval it;
7979

80-
memset(&it, 0, sizeof it);
80+
memset(&it, 0, sizeof(it));
8181
it.it_interval.tv_usec = 1;
8282
setitimer(ITIMER_REAL, &it, NULL);
8383
getitimer(ITIMER_REAL, &it);

pathtrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ upathmatch(struct tcb *const tcp, const kernel_ulong_t upath)
5959
{
6060
char path[PATH_MAX + 1];
6161

62-
return umovestr(tcp, upath, sizeof path, path) > 0 &&
62+
return umovestr(tcp, upath, sizeof(path), path) > 0 &&
6363
pathmatch(path);
6464
}
6565

strace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ startup_child(char **argv)
13721372
continue;
13731373
len = strlen(pathname);
13741374
}
1375-
else if (n > sizeof pathname - 1)
1375+
else if (n > sizeof(pathname) - 1)
13761376
continue;
13771377
else {
13781378
strncpy(pathname, path, n);

tests/net-accept-connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ main(int ac, const char **av)
6969
if (listen(0, 5))
7070
perror_msg_and_skip("listen");
7171

72-
memset(&addr, 0, sizeof addr);
72+
memset(&addr, 0, sizeof(addr));
7373
assert(getsockname(0, (struct sockaddr *) &addr, &len) == 0);
7474
if (len > sizeof(addr))
7575
len = sizeof(addr);

tests/uio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ main(void)
3939
{
4040
const off_t offset = 0xdefaceddeadbeefLL;
4141
char buf[4];
42-
struct iovec iov = { buf, sizeof buf };
42+
struct iovec iov = { buf, sizeof(buf) };
4343

4444
(void) close(0);
4545
assert(open("/dev/zero", O_RDONLY) == 0);
46-
assert(pread(0, buf, sizeof buf, offset) == 4);
46+
assert(pread(0, buf, sizeof(buf), offset) == 4);
4747
assert(preadv(0, &iov, 1, offset) == 4);
4848
assert(!close(0));
4949

5050
assert(open("/dev/null", O_WRONLY) == 0);
51-
assert(pwrite(0, buf, sizeof buf, offset) == 4);
51+
assert(pwrite(0, buf, sizeof(buf), offset) == 4);
5252
assert(pwritev(0, &iov, 1, offset) == 4);
5353
assert(!close(0));
5454

util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n)
711711
}
712712

713713
/* Cap path length to the path buffer size */
714-
if (n > sizeof path - 1)
715-
n = sizeof path - 1;
714+
if (n > sizeof(path) - 1)
715+
n = sizeof(path) - 1;
716716

717717
/* Fetch one byte more to find out whether path length > n. */
718718
nul_seen = umovestr(tcp, addr, n + 1, path);

0 commit comments

Comments
 (0)