summaryrefslogtreecommitdiff
path: root/security/apparmor/include
diff options
context:
space:
mode:
authorRyan Lee <ryan.lee@canonical.com>2025-05-01 22:54:38 +0300
committerJohn Johansen <john.johansen@canonical.com>2025-05-18 04:20:10 +0300
commit6c055e62560b958354625604293652753d82bcae (patch)
tree6baeef9d49c079b4b52f8ba300c3f66ea1e44481 /security/apparmor/include
parenta949b46e7d82ef0fed09aa0590442156d44d39b1 (diff)
downloadlinux-6c055e62560b958354625604293652753d82bcae.tar.xz
apparmor: ensure WB_HISTORY_SIZE value is a power of 2
WB_HISTORY_SIZE was defined to be a value not a power of 2, despite a comment in the declaration of struct match_workbuf stating it is and a modular arithmetic usage in the inc_wb_pos macro assuming that it is. Bump WB_HISTORY_SIZE's value up to 32 and add a BUILD_BUG_ON_NOT_POWER_OF_2 line to ensure that any future changes to the value of WB_HISTORY_SIZE respect this requirement. Fixes: 136db994852a ("apparmor: increase left match history buffer size") Signed-off-by: Ryan Lee <ryan.lee@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/include')
-rw-r--r--security/apparmor/include/match.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h
index 01a703fef8e1..21e049b40824 100644
--- a/security/apparmor/include/match.h
+++ b/security/apparmor/include/match.h
@@ -137,7 +137,8 @@ aa_state_t aa_dfa_matchn_until(struct aa_dfa *dfa, aa_state_t start,
void aa_dfa_free_kref(struct kref *kref);
-#define WB_HISTORY_SIZE 24
+/* This needs to be a power of 2 */
+#define WB_HISTORY_SIZE 32
struct match_workbuf {
unsigned int count;
unsigned int pos;