On Thu, 2024-09-05 at 13:52 +0800, Shung-Hsi Yu wrote: > Commit 980ca8ceeae6 ("bpf: check bpf_dummy_struct_ops program params for > test runs") does bitwise AND between reg_type and PTR_MAYBE_NULL, which > is correct, but due to type difference the compiler complains: > > net/bpf/bpf_dummy_struct_ops.c:118:31: warning: bitwise operation between different enumeration types ('const enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion] > 118 | if (info && (info->reg_type & PTR_MAYBE_NULL)) > | ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ > > Workaround the warning by moving the type_may_be_null() helper from > verifier.c into bpf_verifier.h, and reuse it here to check whether param > is nullable. > > Fixes: 980ca8ceeae6 ("bpf: check bpf_dummy_struct_ops program params for test runs") > Reported-by: kernel test robot <lkp@xxxxxxxxx> > Closes: https://lore.kernel.org/oe-kbuild-all/202404241956.HEiRYwWq-lkp@xxxxxxxxx/ > Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@xxxxxxxx> > --- Thank you for this fix. Replacing other uses of PTR_MAYBE_NULL suggested by Matt seems like a good idea, but it does not preclude merge for this patch. Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> [...]