Fix a few sizeof style issues
Reported by kernel's checkpatch.pl script.
This commit is contained in:
parent
7f2b636a22
commit
a74c084611
2
count.c
2
count.c
@ -77,7 +77,7 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
|
||||
/* Initialize it. */
|
||||
struct itimerval it;
|
||||
|
||||
memset(&it, 0, sizeof it);
|
||||
memset(&it, 0, sizeof(it));
|
||||
it.it_interval.tv_usec = 1;
|
||||
setitimer(ITIMER_REAL, &it, NULL);
|
||||
getitimer(ITIMER_REAL, &it);
|
||||
|
@ -59,7 +59,7 @@ upathmatch(struct tcb *const tcp, const kernel_ulong_t upath)
|
||||
{
|
||||
char path[PATH_MAX + 1];
|
||||
|
||||
return umovestr(tcp, upath, sizeof path, path) > 0 &&
|
||||
return umovestr(tcp, upath, sizeof(path), path) > 0 &&
|
||||
pathmatch(path);
|
||||
}
|
||||
|
||||
|
2
strace.c
2
strace.c
@ -1372,7 +1372,7 @@ startup_child(char **argv)
|
||||
continue;
|
||||
len = strlen(pathname);
|
||||
}
|
||||
else if (n > sizeof pathname - 1)
|
||||
else if (n > sizeof(pathname) - 1)
|
||||
continue;
|
||||
else {
|
||||
strncpy(pathname, path, n);
|
||||
|
@ -69,7 +69,7 @@ main(int ac, const char **av)
|
||||
if (listen(0, 5))
|
||||
perror_msg_and_skip("listen");
|
||||
|
||||
memset(&addr, 0, sizeof addr);
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
assert(getsockname(0, (struct sockaddr *) &addr, &len) == 0);
|
||||
if (len > sizeof(addr))
|
||||
len = sizeof(addr);
|
||||
|
@ -39,16 +39,16 @@ main(void)
|
||||
{
|
||||
const off_t offset = 0xdefaceddeadbeefLL;
|
||||
char buf[4];
|
||||
struct iovec iov = { buf, sizeof buf };
|
||||
struct iovec iov = { buf, sizeof(buf) };
|
||||
|
||||
(void) close(0);
|
||||
assert(open("/dev/zero", O_RDONLY) == 0);
|
||||
assert(pread(0, buf, sizeof buf, offset) == 4);
|
||||
assert(pread(0, buf, sizeof(buf), offset) == 4);
|
||||
assert(preadv(0, &iov, 1, offset) == 4);
|
||||
assert(!close(0));
|
||||
|
||||
assert(open("/dev/null", O_WRONLY) == 0);
|
||||
assert(pwrite(0, buf, sizeof buf, offset) == 4);
|
||||
assert(pwrite(0, buf, sizeof(buf), offset) == 4);
|
||||
assert(pwritev(0, &iov, 1, offset) == 4);
|
||||
assert(!close(0));
|
||||
|
||||
|
4
util.c
4
util.c
@ -711,8 +711,8 @@ printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n)
|
||||
}
|
||||
|
||||
/* Cap path length to the path buffer size */
|
||||
if (n > sizeof path - 1)
|
||||
n = sizeof path - 1;
|
||||
if (n > sizeof(path) - 1)
|
||||
n = sizeof(path) - 1;
|
||||
|
||||
/* Fetch one byte more to find out whether path length > n. */
|
||||
nul_seen = umovestr(tcp, addr, n + 1, path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user