bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v1] bpf: Fix warning for cast from restricted gfp_t in verifier
@ 2022-03-21 18:58 Joanne Koong
  2022-03-21 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Joanne Koong @ 2022-03-21 18:58 UTC (permalink / raw)
  To: bpf; +Cc: andrii, ast, daniel, Joanne Koong, kernel test robot

From: Joanne Koong <joannelkoong@gmail.com>

This fixes the sparse warning reported by the kernel test robot:

kernel/bpf/verifier.c:13499:47: sparse: warning: cast from restricted gfp_t
kernel/bpf/verifier.c:13501:47: sparse: warning: cast from restricted gfp_t

This fix can be verified locally by running:
1) wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O make.cross

2) chmod +x ~/bin/make.cross

3) COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 ./make.cross
C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

Fixes: b00fa38a9c1c ("bpf: Enable non-atomic allocations in local storage")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
---
 kernel/bpf/verifier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 571ccd7f04eb..d175b70067b3 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -13496,9 +13496,9 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
 		    insn->imm == BPF_FUNC_sk_storage_get ||
 		    insn->imm == BPF_FUNC_inode_storage_get) {
 			if (env->prog->aux->sleepable)
-				insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_KERNEL);
+				insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__force __s32)GFP_KERNEL);
 			else
-				insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_ATOMIC);
+				insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__force __s32)GFP_ATOMIC);
 			insn_buf[1] = *insn;
 			cnt = 2;
 
-- 
2.30.2


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

* Re: [PATCH bpf-next v1] bpf: Fix warning for cast from restricted gfp_t in verifier
  2022-03-21 18:58 [PATCH bpf-next v1] bpf: Fix warning for cast from restricted gfp_t in verifier Joanne Koong
@ 2022-03-21 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-21 20:40 UTC (permalink / raw)
  To: Joanne Koong; +Cc: bpf, andrii, ast, daniel, joannelkoong, lkp

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon, 21 Mar 2022 11:58:02 -0700 you wrote:
> From: Joanne Koong <joannelkoong@gmail.com>
> 
> This fixes the sparse warning reported by the kernel test robot:
> 
> kernel/bpf/verifier.c:13499:47: sparse: warning: cast from restricted gfp_t
> kernel/bpf/verifier.c:13501:47: sparse: warning: cast from restricted gfp_t
> 
> [...]

Here is the summary with links:
  - [bpf-next,v1] bpf: Fix warning for cast from restricted gfp_t in verifier
    https://git.kernel.org/bpf/bpf-next/c/d56c9fe6a068

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] 2+ messages in thread

end of thread, other threads:[~2022-03-21 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 18:58 [PATCH bpf-next v1] bpf: Fix warning for cast from restricted gfp_t in verifier Joanne Koong
2022-03-21 20:40 ` 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).