linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch
@ 2022-11-08  1:58 Yang Jihong
  2022-11-08  6:38 ` Yonghong Song
  2022-11-09 21:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Jihong @ 2022-11-08  1:58 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, mykolal, shuah, sunyucong, bpf,
	linux-kselftest, linux-kernel
  Cc: yangjihong1

test_progs fails to be compiled in the 32-bit arch, log is as follows:

  test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
   1013 |                 sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)",
        |                                                  ~~^
        |                                                    |
        |                                                    long int
        |                                                  %d
   1014 |                         strlen(msg->test_log.log_buf),
        |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |                         |
        |                         size_t {aka unsigned int}

Fix it.

Fixes: 91b2c0afd00c ("selftests/bpf: Add parallelism to test_progs")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/testing/selftests/bpf/test_progs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 0e9a47f97890..3fef451d8831 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1010,7 +1010,7 @@ static inline const char *str_msg(const struct msg *msg, char *buf)
 			msg->subtest_done.have_log);
 		break;
 	case MSG_TEST_LOG:
-		sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)",
+		sprintf(buf, "MSG_TEST_LOG (cnt: %zu, last: %d)",
 			strlen(msg->test_log.log_buf),
 			msg->test_log.is_last);
 		break;
-- 
2.30.GIT


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch
  2022-11-08  1:58 [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch Yang Jihong
@ 2022-11-08  6:38 ` Yonghong Song
  2022-11-09 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-11-08  6:38 UTC (permalink / raw)
  To: Yang Jihong, ast, daniel, andrii, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, mykolal, shuah,
	sunyucong, bpf, linux-kselftest, linux-kernel



On 11/7/22 5:58 PM, Yang Jihong wrote:
> test_progs fails to be compiled in the 32-bit arch, log is as follows:
> 
>    test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>     1013 |                 sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)",
>          |                                                  ~~^
>          |                                                    |
>          |                                                    long int
>          |                                                  %d
>     1014 |                         strlen(msg->test_log.log_buf),
>          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>          |                         |
>          |                         size_t {aka unsigned int}
> 
> Fix it.
> 
> Fixes: 91b2c0afd00c ("selftests/bpf: Add parallelism to test_progs")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch
  2022-11-08  1:58 [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch Yang Jihong
  2022-11-08  6:38 ` Yonghong Song
@ 2022-11-09 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-09 21:00 UTC (permalink / raw)
  To: Yang Jihong
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, mykolal, shuah, sunyucong, bpf,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to bpf/bpf.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Tue, 8 Nov 2022 09:58:57 +0800 you wrote:
> test_progs fails to be compiled in the 32-bit arch, log is as follows:
> 
>   test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>    1013 |                 sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)",
>         |                                                  ~~^
>         |                                                    |
>         |                                                    long int
>         |                                                  %d
>    1014 |                         strlen(msg->test_log.log_buf),
>         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         |                         |
>         |                         size_t {aka unsigned int}
> 
> [...]

Here is the summary with links:
  - selftests/bpf: Fix test_progs compilation failure in 32-bit arch
    https://git.kernel.org/bpf/bpf/c/5704bc7e8991

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-09 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  1:58 [PATCH] selftests/bpf: Fix test_progs compilation failure in 32-bit arch Yang Jihong
2022-11-08  6:38 ` Yonghong Song
2022-11-09 21:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).