From: Ye Liu Two error messages incorrectly spelled the madvise() function name as "madvice". Fix the typo in both occurrences. Signed-off-by: Ye Liu --- tools/mm/page-types.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index d7e5e8902af8..6594245217a8 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -997,7 +997,7 @@ static void walk_file_range(const char *name, int fd, /* turn off readahead */ if (madvise(ptr, len, MADV_RANDOM)) - fatal("madvice failed: %s", name); + fatal("madvise failed: %s", name); if (sigsetjmp(sigbus_jmp, 1)) { end = off + sigbus_addr ? sigbus_addr - ptr : 0; @@ -1015,7 +1015,7 @@ static void walk_file_range(const char *name, int fd, /* turn off harvesting reference bits */ if (madvise(ptr, len, MADV_SEQUENTIAL)) - fatal("madvice failed: %s", name); + fatal("madvise failed: %s", name); if (pagemap_read(buf, (unsigned long)ptr / page_size, nr_pages) != nr_pages) -- 2.43.0 From: Ye Liu The ternary operator (?:) has lower precedence than addition (+), so the expression `off + sigbus_addr ? sigbus_addr - ptr : 0` was parsed as `(off + sigbus_addr) ? (sigbus_addr - ptr) : 0` rather than the intended `off + (sigbus_addr ? sigbus_addr - ptr : 0)`. Add explicit parentheses to ensure the correct evaluation order. Signed-off-by: Ye Liu --- tools/mm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index 6594245217a8..66f429f2b698 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -1000,7 +1000,7 @@ static void walk_file_range(const char *name, int fd, fatal("madvise failed: %s", name); if (sigsetjmp(sigbus_jmp, 1)) { - end = off + sigbus_addr ? sigbus_addr - ptr : 0; + end = off + (sigbus_addr ? sigbus_addr - ptr : 0); fprintf(stderr, "got sigbus at offset %lld: %s\n", (long long)end, name); goto got_sigbus; -- 2.43.0 From: Ye Liu The --kpageflags option requires an argument to specify the kpageflags file path, but has_arg was set to 0 (no_argument) in the long options table. Change it to 1 (required_argument) so getopt_long correctly parses the argument. Signed-off-by: Ye Liu --- tools/mm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index 66f429f2b698..7fc5a8be5997 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -1261,7 +1261,7 @@ static const struct option opts[] = { { "no-summary", 0, NULL, 'N' }, { "hwpoison" , 0, NULL, 'X' }, { "unpoison" , 0, NULL, 'x' }, - { "kpageflags", 0, NULL, 'F' }, + { "kpageflags", 1, NULL, 'F' }, { "help" , 0, NULL, 'h' }, { NULL , 0, NULL, 0 } }; -- 2.43.0