aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2021-01-14 15:44:09 +0000
committerWill Deacon <will@kernel.org>2021-01-21 12:51:03 +0000
commit5857c9209ce58f8e262889539ccdf63e73ad7a93 (patch)
tree0b9075e3be2ab8569b0f5e2777ff6b4ea813fde5 /include/linux/mm.h
parentmm: Use static initialisers for immutable fields of 'struct vm_fault' (diff)
downloadwireguard-linux-5857c9209ce58f8e262889539ccdf63e73ad7a93.tar.xz
wireguard-linux-5857c9209ce58f8e262889539ccdf63e73ad7a93.zip
mm: Mark anonymous struct field of 'struct vm_fault' as 'const'
The fields of this struct are only ever read after being initialised, so mark it 'const' before somebody tries to modify it again. GCC will then complain (with an error) about modification of these fields after they have been initialised, although LLVM currently allows them without even a warning: https://bugs.llvm.org/show_bug.cgi?id=48755 Hopefully, future versions of LLVM will emit a warning. Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e0f056753bef..7ff3d9817d38 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -514,7 +514,7 @@ static inline bool fault_flag_allow_retry_first(unsigned int flags)
* pgoff should be used in favour of virtual_address, if possible.
*/
struct vm_fault {
- struct {
+ const struct {
struct vm_area_struct *vma; /* Target VMA */
gfp_t gfp_mask; /* gfp mask to be used for allocations */
pgoff_t pgoff; /* Logical page offset based on vma */