]> git.baikalelectronics.ru Git - kernel.git/commit
mm: Mark anonymous struct field of 'struct vm_fault' as 'const'
authorWill Deacon <will@kernel.org>
Thu, 14 Jan 2021 15:44:09 +0000 (15:44 +0000)
committerWill Deacon <will@kernel.org>
Thu, 21 Jan 2021 12:51:03 +0000 (12:51 +0000)
commit5000baf4431442f6e92e078a8789ffde8a81b844
tree0b9075e3be2ab8569b0f5e2777ff6b4ea813fde5
parent7d9a8b13ac8731941d37ee107f19c2389b9bf091
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>
include/linux/mm.h