Commit b4399546 authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Daniel Borkmann
Browse files

bpf: rename bpf_ctx_wide_store_ok to bpf_ctx_wide_access_ok



Rename bpf_ctx_wide_store_ok to bpf_ctx_wide_access_ok to indicate
that it can be used for both loads and stores.

Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 81f522f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -747,7 +747,7 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default)
	return size <= size_default && (size & (size - 1)) == 0;
}

#define bpf_ctx_wide_store_ok(off, size, type, field)			\
#define bpf_ctx_wide_access_ok(off, size, type, field)			\
	(size == sizeof(__u64) &&					\
	off >= offsetof(type, field) &&					\
	off + sizeof(__u64) <= offsetofend(type, field) &&		\
+6 −6
Original line number Diff line number Diff line
@@ -6890,12 +6890,12 @@ static bool sock_addr_is_valid_access(int off, int size,
			if (!bpf_ctx_narrow_access_ok(off, size, size_default))
				return false;
		} else {
			if (bpf_ctx_wide_store_ok(off, size,
			if (bpf_ctx_wide_access_ok(off, size,
						   struct bpf_sock_addr,
						   user_ip6))
				return true;

			if (bpf_ctx_wide_store_ok(off, size,
			if (bpf_ctx_wide_access_ok(off, size,
						   struct bpf_sock_addr,
						   msg_src_ip6))
				return true;