bpf: rename bpf_ctx_wide_store_ok to bpf_ctx_wide_access_ok
authorStanislav Fomichev <sdf@google.com>
Mon, 15 Jul 2019 16:39:52 +0000 (09:39 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 15 Jul 2019 21:15:53 +0000 (23:15 +0200)
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: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/filter.h
net/core/filter.c

index 6d944369ca876005021a1f010605a661acdc258d..ff65d22cf336935c9406930496dc8a8f57a0cbd0 100644 (file)
@@ -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) &&              \
index 47f6386fb17afbd41c2685097b9eac75d92c634b..c5983ddb1a9f48dc1a259c270ce620d98e79a227 100644 (file)
@@ -6890,14 +6890,14 @@ 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,
-                                                 struct bpf_sock_addr,
-                                                 user_ip6))
+                       if (bpf_ctx_wide_access_ok(off, size,
+                                                  struct bpf_sock_addr,
+                                                  user_ip6))
                                return true;
 
-                       if (bpf_ctx_wide_store_ok(off, size,
-                                                 struct bpf_sock_addr,
-                                                 msg_src_ip6))
+                       if (bpf_ctx_wide_access_ok(off, size,
+                                                  struct bpf_sock_addr,
+                                                  msg_src_ip6))
                                return true;
 
                        if (size != size_default)