Skip to content

Commit a953e6c

Browse files
joannekoongNobody
authored andcommitted
bpf: Fix warning for cast from restricted gfp_t in verifier
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: b00fa38 ("bpf: Enable non-atomic allocations in local storage") Reported-by: kernel test robot <[email protected]> Signed-off-by: Joanne Koong <[email protected]>
1 parent 14d9a00 commit a953e6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13496,9 +13496,9 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
1349613496
insn->imm == BPF_FUNC_sk_storage_get ||
1349713497
insn->imm == BPF_FUNC_inode_storage_get) {
1349813498
if (env->prog->aux->sleepable)
13499-
insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_KERNEL);
13499+
insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__force __s32)GFP_KERNEL);
1350013500
else
13501-
insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_ATOMIC);
13501+
insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__force __s32)GFP_ATOMIC);
1350213502
insn_buf[1] = *insn;
1350313503
cnt = 2;
1350413504

0 commit comments

Comments
 (0)