summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-10 08:54:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-10 08:54:13 -0800
commit85f24b0ace9aa79142f632fc3ccc730a8d2a4a28 (patch)
tree29cd3fd0b191f3de84af9f5700823cc135f0b824 /fs
parentbffce9b427b37e2f54416a695ec5d7f030ba610f (diff)
parent44dd7cfbd1db5199cf7afe03158a578a64b55800 (diff)
Merge tag 'hardening-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening updates from Kees Cook: "Mostly small cleanups and various scattered annotations and flex array warning fixes that we reviewed by unlanded in other trees. Introduces new annotation for expanding counted_by to pointer members, now that compiler behavior between GCC and Clang has been normalized. - Various missed __counted_by annotations (Thorsten Blum) - Various missed -Wflex-array-member-not-at-end fixes (Gustavo A. R. Silva) - Avoid leftover tempfiles for interrupted compile-time FORTIFY tests (Nicolas Schier) - Remove non-existant CONFIG_UBSAN_REPORT_FULL from docs (Stefan Wiehler) - fortify: Use C arithmetic not FIELD_xxx() in FORTIFY_REASON defines (David Laight) - Add __counted_by_ptr attribute, tests, and first user (Bill Wendling, Kees Cook) - Update MAINTAINERS file to make hardening section not include pstore" * tag 'hardening-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: MAINTAINERS: pstore: Remove L: entry nfp: tls: Avoid -Wflex-array-member-not-at-end warnings carl9170: Avoid -Wflex-array-member-not-at-end warning coredump: Use __counted_by_ptr for struct core_name::corename lkdtm/bugs: Add __counted_by_ptr() test PTR_BOUNDS compiler_types.h: Attributes: Add __counted_by_ptr macro fortify: Cleanup temp file also on non-successful exit fortify: Rename temporary file to match ignore pattern fortify: Use C arithmetic not FIELD_xxx() in FORTIFY_REASON defines ecryptfs: Annotate struct ecryptfs_message with __counted_by fs/xattr: Annotate struct simple_xattr with __counted_by crypto: af_alg - Annotate struct af_alg_iv with __counted_by Kconfig.ubsan: Remove CONFIG_UBSAN_REPORT_FULL from documentation drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning
Diffstat (limited to 'fs')
-rw-r--r--fs/coredump.c8
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/coredump.c b/fs/coredump.c
index d9597610a6ca..4ce7c80b39c8 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -92,7 +92,7 @@ enum coredump_type_t {
};
struct core_name {
- char *corename;
+ char *corename __counted_by_ptr(size);
int used, size;
unsigned int core_pipe_limit;
bool core_dumped;
@@ -106,15 +106,15 @@ static int expand_corename(struct core_name *cn, int size)
size = kmalloc_size_roundup(size);
corename = krealloc(cn->corename, size, GFP_KERNEL);
-
if (!corename)
return -ENOMEM;
+ cn->corename = corename;
+ cn->size = size;
+
if (size > core_name_size) /* racy but harmless */
core_name_size = size;
- cn->size = size;
- cn->corename = corename;
return 0;
}
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 62a2ea7f59ed..f58b12be8267 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -359,7 +359,7 @@ struct ecryptfs_message {
/* Inherits from msg_ctx->index */
u32 index;
u32 data_len;
- u8 data[];
+ u8 data[] __counted_by(data_len);
};
struct ecryptfs_msg_ctx {