* [PATCH] selftests/mm: mremap_test: fix build warning
@ 2024-01-11 8:20 Muhammad Usama Anjum
2024-01-11 21:14 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-01-11 8:20 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, Joel Fernandes (Google), Lorenzo Stoakes
Cc: Muhammad Usama Anjum, kernel, linux-mm, linux-kselftest, linux-kernel
Fix following build warning:
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long unsigned int’
Fixes: a4cb3b243343 ("selftests: mm: add a test for remapping to area immediately after existing mapping")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/mm/mremap_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c
index 1d4c1589c305..dd1cbb068982 100644
--- a/tools/testing/selftests/mm/mremap_test.c
+++ b/tools/testing/selftests/mm/mremap_test.c
@@ -457,7 +457,7 @@ static long long remap_region(struct config c, unsigned int threshold_mb,
char c = (char) rand();
if (((char *) dest_preamble_addr)[i] != c) {
- ksft_print_msg("Preamble data after remap doesn't match at offset %d\n",
+ ksft_print_msg("Preamble data after remap doesn't match at offset %llu\n",
i);
ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff,
((char *) dest_preamble_addr)[i] & 0xff);
--
2.42.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/mm: mremap_test: fix build warning
2024-01-11 8:20 [PATCH] selftests/mm: mremap_test: fix build warning Muhammad Usama Anjum
@ 2024-01-11 21:14 ` Andrew Morton
2024-01-12 6:50 ` Muhammad Usama Anjum
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2024-01-11 21:14 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Shuah Khan, Joel Fernandes (Google),
Lorenzo Stoakes, kernel, linux-mm, linux-kselftest, linux-kernel
On Thu, 11 Jan 2024 13:20:38 +0500 Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:
> Fix following build warning:
> warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long unsigned int’
>
Looks good to me, but... grumble.
`i' is an integer. That's just how it is, Blame Fortran if you like.
Discovering that someone used `i' for an unsigned long long is like
seeing
struct inode *page;
It is surprising, and readers shouldn't be subjected to surprises.
`i' is used in two ways here. Twice to iterate across threshold values
(as a ULL) and once to iterate across dest_preamble_size, which is an
int. It would be better to have two different variables for the two
different uses. Ones with more appropriate names than `i'.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/mm: mremap_test: fix build warning
2024-01-11 21:14 ` Andrew Morton
@ 2024-01-12 6:50 ` Muhammad Usama Anjum
0 siblings, 0 replies; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-01-12 6:50 UTC (permalink / raw)
To: Andrew Morton
Cc: Muhammad Usama Anjum, Shuah Khan, Joel Fernandes (Google),
Lorenzo Stoakes, kernel, linux-mm, linux-kselftest, linux-kernel
On 1/12/24 2:14 AM, Andrew Morton wrote:
> On Thu, 11 Jan 2024 13:20:38 +0500 Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:
>
>> Fix following build warning:
>> warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long unsigned int’
>>
>
> Looks good to me, but... grumble.
>
> `i' is an integer. That's just how it is, Blame Fortran if you like.
Didn't know this. Thanks for sharing. I'll send a v2 by using two variables.
> Discovering that someone used `i' for an unsigned long long is like
> seeing
>
> struct inode *page;
>
> It is surprising, and readers shouldn't be subjected to surprises.
>
> `i' is used in two ways here. Twice to iterate across threshold values
> (as a ULL) and once to iterate across dest_preamble_size, which is an
> int. It would be better to have two different variables for the two
> different uses. Ones with more appropriate names than `i'.
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-12 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11 8:20 [PATCH] selftests/mm: mremap_test: fix build warning Muhammad Usama Anjum
2024-01-11 21:14 ` Andrew Morton
2024-01-12 6:50 ` Muhammad Usama Anjum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox