bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp
@ 2020-09-29  1:50 John Fastabend
  2020-09-29  4:34 ` Alexei Starovoitov
  2020-09-29 12:20 ` patchwork-bot+bpf
  0 siblings, 2 replies; 3+ messages in thread
From: John Fastabend @ 2020-09-29  1:50 UTC (permalink / raw)
  To: songliubraving, ast, daniel; +Cc: netdev, bpf, john.fastabend

Fix warning in bpf selftests,

progs/test_raw_tp_test_run.c:18:10: warning: cast to smaller integer type 'int' from 'struct task_struct *' [-Wpointer-to-int-cast]

Change int type cast to long to fix. Discovered with gcc-9 and llvm-11+
where llvm was recent main branch.

Fixes: 09d8ad16885ee ("selftests/bpf: Add raw_tp_test_run")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 .../selftests/bpf/progs/test_raw_tp_test_run.c     |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c b/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c
index 1521853597d7..4c63cc87b9d0 100644
--- a/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c
+++ b/tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c
@@ -15,7 +15,7 @@ int BPF_PROG(rename, struct task_struct *task, char *comm)
 	count++;
 	if ((__u64) task == 0x1234ULL && (__u64) comm == 0x5678ULL) {
 		on_cpu = bpf_get_smp_processor_id();
-		return (int)task + (int)comm;
+		return (long)task + (long)comm;
 	}
 
 	return 0;


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

* Re: [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp
  2020-09-29  1:50 [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp John Fastabend
@ 2020-09-29  4:34 ` Alexei Starovoitov
  2020-09-29 12:20 ` patchwork-bot+bpf
  1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-09-29  4:34 UTC (permalink / raw)
  To: John Fastabend
  Cc: Song Liu, Alexei Starovoitov, Daniel Borkmann, Network Development, bpf

On Mon, Sep 28, 2020 at 6:51 PM John Fastabend <john.fastabend@gmail.com> wrote:
>
> Fix warning in bpf selftests,
>
> progs/test_raw_tp_test_run.c:18:10: warning: cast to smaller integer type 'int' from 'struct task_struct *' [-Wpointer-to-int-cast]
>
> Change int type cast to long to fix. Discovered with gcc-9 and llvm-11+
> where llvm was recent main branch.
>
> Fixes: 09d8ad16885ee ("selftests/bpf: Add raw_tp_test_run")
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>

Applied. Thanks

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

* Re: [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp
  2020-09-29  1:50 [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp John Fastabend
  2020-09-29  4:34 ` Alexei Starovoitov
@ 2020-09-29 12:20 ` patchwork-bot+bpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bpf @ 2020-09-29 12:20 UTC (permalink / raw)
  To: John Fastabend; +Cc: bpf

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Mon, 28 Sep 2020 18:50:47 -0700 you wrote:
> Fix warning in bpf selftests,
> 
> progs/test_raw_tp_test_run.c:18:10: warning: cast to smaller integer type 'int' from 'struct task_struct *' [-Wpointer-to-int-cast]
> 
> Change int type cast to long to fix. Discovered with gcc-9 and llvm-11+
> where llvm was recent main branch.
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp
    https://git.kernel.org/bpf/bpf-next/c/00e8c44a147a

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:[~2020-09-29 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29  1:50 [bpf-next PATCH] bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp John Fastabend
2020-09-29  4:34 ` Alexei Starovoitov
2020-09-29 12:20 ` patchwork-bot+bpf

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).