From 2c373648e1fefd5c7c833631e2c56b3d0f9fc64e Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Mon, 22 Jun 2026 14:35:37 +0200 Subject: [PATCH] Align cleaning, promotion and prefetch policy config structs This properly alignes data and prevents UBSan from reporting misalignment errors. Signed-off-by: Rafal Stefanowski --- src/cleaning/cleaning.h | 2 +- src/prefetch/ocf_prefetch_priv.h | 2 +- src/promotion/promotion.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cleaning/cleaning.h b/src/cleaning/cleaning.h index f67a79e1d..1e56af270 100644 --- a/src/cleaning/cleaning.h +++ b/src/cleaning/cleaning.h @@ -22,7 +22,7 @@ struct ocf_request; struct cleaning_policy_config { uint8_t data[CLEANING_POLICY_CONFIG_BYTES]; -}; +} __attribute__((aligned(4))); struct cleaning_policy { union { diff --git a/src/prefetch/ocf_prefetch_priv.h b/src/prefetch/ocf_prefetch_priv.h index 2a3d9bd28..5f36a9b0e 100644 --- a/src/prefetch/ocf_prefetch_priv.h +++ b/src/prefetch/ocf_prefetch_priv.h @@ -19,7 +19,7 @@ struct prefetch_policy_config { uint8_t data[PREFETCH_POLICY_CONFIG_BYTES]; -}; +} __attribute__((aligned(4))); #define OCF_PF_ID_VALID(pf_id) ((pf_id) != ocf_pf_none && (pf_id) < ocf_pf_num) #define OCF_PF_ID_ENABLED(pf_id, enabled_mask) ((1 << ((pf_id))) & enabled_mask) diff --git a/src/promotion/promotion.h b/src/promotion/promotion.h index f4005181a..612b5b62d 100644 --- a/src/promotion/promotion.h +++ b/src/promotion/promotion.h @@ -15,7 +15,7 @@ struct promotion_policy_config { uint8_t data[PROMOTION_POLICY_CONFIG_BYTES]; -}; +} __attribute__((aligned(4))); typedef struct ocf_promotion_policy *ocf_promotion_policy_t;