CHECK: Macro argument 'off' may be better as '(off)' to avoid precedence issues #68: FILE: tools/testing/selftests/bpf/progs/verifier_ctx.c:316: +#define no_rewrite_ctx_access(type, name, off, load_t) \ SEC(type) \ __description(type ": read ctx at fixed offset") \ __success \ + int no_rewrite_##name##_fixed(void *ctx) \ { \ + char *p = ctx; \ + volatile load_t val; \ + \ + val = *(load_t *)(p + off); \ + (void)val; \ + return 0; \ } \ SEC(type) \ __description(type ": reject variable offset ctx access") \ __failure __msg("variable ctx access var_off=") \ + int no_rewrite_##name##_var(void *ctx) \ { \ + __u64 off_var = bpf_get_prandom_u32(); \ + char *p = ctx; \ + \ + off_var &= 4; \ + p += off_var; \ + return *(load_t *)p; \ } \ SEC(type) \ __description(type ": reject negative offset ctx access") \ + __failure __msg("invalid bpf_context access") \ + int no_rewrite_##name##_neg(void *ctx) \ { \ + char *p = ctx; \ + \ + p -= 612; \ + return *(load_t *)p; \ } WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst #84: FILE: tools/testing/selftests/bpf/progs/verifier_ctx.c:323: + volatile load_t val; \ total: 0 errors, 1 warnings, 1 checks, 110 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. Commit 1dd942299cde ("selftests/bpf: Convert ctx tests from ASM to C") has style problems, please review. NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE FILE_PATH_CHANGES GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. total: 0 errors, 1 warnings, 1 checks, 110 lines checked