]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Determine buf_info inside check_buffer_access()
authorShung-Hsi Yu <shung-hsi.yu@suse.com>
Mon, 7 Mar 2022 05:29:18 +0000 (13:29 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 8 Mar 2022 14:36:45 +0000 (15:36 +0100)
commit69460e2647592e21f0a206d59b8a3083b978b4dd
tree03e6959f89fc523b68b0fc98f19a81cdaa6cfafd
parent028c4c02c067f3223c65bc632fca16ec9d2cce7c
bpf: Determine buf_info inside check_buffer_access()

Instead of determining buf_info string in the caller of check_buffer_access(),
we can determine whether the register type is read-only through
type_is_rdonly_mem() helper inside check_buffer_access() and construct
buf_info, making the code slightly cleaner.

Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/YiWYLnAkEZXBP/gH@syu-laptop
kernel/bpf/verifier.c