]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
lib: reuse page_ext_data() to obtain codetag_ref
authorSuren Baghdasaryan <surenb@google.com>
Thu, 11 Jul 2024 22:04:56 +0000 (15:04 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 18 Jul 2024 04:05:18 +0000 (21:05 -0700)
codetag_ref_from_page_ext() reimplements the same calculation as
page_ext_data().  Reuse existing function instead.

Link: https://lkml.kernel.org/r/20240711220457.1751071-2-surenb@google.com
Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Sourav Panda <souravpanda@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/pgalloc_tag.h

index 9cacadbd61f8c1c4bb68879bf8e01f3ca79576ec..acb1e9ce79815436385ba0620de3382554642027 100644 (file)
@@ -15,7 +15,7 @@ extern struct page_ext_operations page_alloc_tagging_ops;
 
 static inline union codetag_ref *codetag_ref_from_page_ext(struct page_ext *page_ext)
 {
-       return (void *)page_ext + page_alloc_tagging_ops.offset;
+       return (union codetag_ref *)page_ext_data(page_ext, &page_alloc_tagging_ops);
 }
 
 static inline struct page_ext *page_ext_from_codetag_ref(union codetag_ref *ref)