* + ocfs2-annotate-more-flexible-array-members-with-__counted_by_le.patch added to mm-nonmm-unstable branch
@ 2025-12-21 19:12 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-12-21 19:12 UTC (permalink / raw)
To: mm-commits, piaojun, mark, junxiao.bi, jlbec, jiangqi903,
heming.zhao, gechangwei, dmantipov, akpm
The patch titled
Subject: ocfs2: annotate more flexible array members with __counted_by_le()
has been added to the -mm mm-nonmm-unstable branch. Its filename is
ocfs2-annotate-more-flexible-array-members-with-__counted_by_le.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ocfs2-annotate-more-flexible-array-members-with-__counted_by_le.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Dmitry Antipov <dmantipov@yandex.ru>
Subject: ocfs2: annotate more flexible array members with __counted_by_le()
Date: Tue, 21 Oct 2025 13:55:18 +0300
Annotate flexible array members of 'struct ocfs2_local_alloc' and 'struct
ocfs2_inline_data' with '__counted_by_le()' attribute to improve array
bounds checking when CONFIG_UBSAN_BOUNDS is enabled, and prefer the
convenient 'memset()' over an explicit loop to simplify
'ocfs2_clear_local_alloc()'.
Link: https://lkml.kernel.org/r/20251021105518.119953-1-dmantipov@yandex.ru
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/ocfs2/localalloc.c | 4 +---
fs/ocfs2/ocfs2_fs.h | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
--- a/fs/ocfs2/localalloc.c~ocfs2-annotate-more-flexible-array-members-with-__counted_by_le
+++ a/fs/ocfs2/localalloc.c
@@ -905,13 +905,11 @@ bail:
static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc)
{
struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
- int i;
alloc->id1.bitmap1.i_total = 0;
alloc->id1.bitmap1.i_used = 0;
la->la_bm_off = 0;
- for(i = 0; i < le16_to_cpu(la->la_size); i++)
- la->la_bitmap[i] = 0;
+ memset(la->la_bitmap, 0, le16_to_cpu(la->la_size));
}
#if 0
--- a/fs/ocfs2/ocfs2_fs.h~ocfs2-annotate-more-flexible-array-members-with-__counted_by_le
+++ a/fs/ocfs2/ocfs2_fs.h
@@ -641,7 +641,7 @@ struct ocfs2_local_alloc
__le16 la_size; /* Size of included bitmap, in bytes */
__le16 la_reserved1;
__le64 la_reserved2;
-/*10*/ __u8 la_bitmap[];
+/*10*/ __u8 la_bitmap[] __counted_by_le(la_size);
};
/*
@@ -654,7 +654,7 @@ struct ocfs2_inline_data
* for data, starting at id_data */
__le16 id_reserved0;
__le32 id_reserved1;
- __u8 id_data[]; /* Start of user data */
+ __u8 id_data[] __counted_by_le(id_count); /* Start of user data */
};
/*
_
Patches currently in -mm which might be from dmantipov@yandex.ru are
ocfs2-adjust-ocfs2_xa_remove_entry-to-match-ubsan-boundary-checks.patch
ocfs2-annotate-more-flexible-array-members-with-__counted_by_le.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-21 19:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-21 19:12 + ocfs2-annotate-more-flexible-array-members-with-__counted_by_le.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.