Skip to content

Commit

Permalink
selftests: mm: fix some build warnings
Browse files Browse the repository at this point in the history
Fix build warnings:
pagemap_ioctl.c:1154:38: warning: format `%s' expects a matching `char *' argument [-Wformat=]
pagemap_ioctl.c:1162:51: warning: format `%ld' expects argument of type `long int', but argument 2 has type `int' [-Wformat=]
pagemap_ioctl.c:1192:51: warning: format `%ld' expects argument of type `long int', but argument 2 has type `int' [-Wformat=]
pagemap_ioctl.c:1600:51: warning: format `%ld' expects argument of type `long int', but argument 2 has type `int' [-Wformat=]
pagemap_ioctl.c:1628:51: warning: format `%ld' expects argument of type `long int', but argument 2 has type `int' [-Wformat=]

Link: https://lkml.kernel.org/r/20231103182343.2874015-2-usama.anjum@collabora.com
Fixes: 46fd75d ("selftests: mm: add pagemap ioctl tests")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Muhammad Usama Anjum authored and Andrew Morton committed Nov 15, 2023
1 parent 019b277 commit 9297e53
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/testing/selftests/mm/pagemap_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,15 +1151,15 @@ int sanity_tests(void)
/* 9. Memory mapped file */
fd = open(__FILE__, O_RDONLY);
if (fd < 0)
ksft_exit_fail_msg("%s Memory mapped file\n");
ksft_exit_fail_msg("%s Memory mapped file\n", __func__);

ret = stat(__FILE__, &sbuf);
if (ret < 0)
ksft_exit_fail_msg("error %d %d %s\n", ret, errno, strerror(errno));

fmem = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (fmem == MAP_FAILED)
ksft_exit_fail_msg("error nomem %ld %s\n", errno, strerror(errno));
ksft_exit_fail_msg("error nomem %d %s\n", errno, strerror(errno));

tmp_buf = malloc(sbuf.st_size);
memcpy(tmp_buf, fmem, sbuf.st_size);
Expand Down Expand Up @@ -1189,7 +1189,7 @@ int sanity_tests(void)

fmem = mmap(NULL, buf_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (fmem == MAP_FAILED)
ksft_exit_fail_msg("error nomem %ld %s\n", errno, strerror(errno));
ksft_exit_fail_msg("error nomem %d %s\n", errno, strerror(errno));

wp_init(fmem, buf_size);
wp_addr_range(fmem, buf_size);
Expand Down Expand Up @@ -1596,7 +1596,7 @@ int main(void)

fmem = mmap(NULL, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (fmem == MAP_FAILED)
ksft_exit_fail_msg("error nomem %ld %s\n", errno, strerror(errno));
ksft_exit_fail_msg("error nomem %d %s\n", errno, strerror(errno));

wp_init(fmem, sbuf.st_size);
wp_addr_range(fmem, sbuf.st_size);
Expand Down Expand Up @@ -1624,7 +1624,7 @@ int main(void)

fmem = mmap(NULL, buf_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (fmem == MAP_FAILED)
ksft_exit_fail_msg("error nomem %ld %s\n", errno, strerror(errno));
ksft_exit_fail_msg("error nomem %d %s\n", errno, strerror(errno));

wp_init(fmem, buf_size);
wp_addr_range(fmem, buf_size);
Expand Down

0 comments on commit 9297e53

Please sign in to comment.