From b86b1da80acfa97ee6cc18e3d3a44809d4083a1b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 10 Jul 2025 15:11:30 +0200 Subject: [PATCH] sanlock: fix struct copy to avoid aliasing issues Replace direct structure assignment with explicit copying to prevent potential undefined behavior from structure aliasing. This ensures proper memory handling when working with sanlock structures. This possibly fixes regression introduced with commit: e9640e5178769 as unintended side effect. --- daemons/lvmlockd/lvmlockd-sanlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c index 137526dd1..48ed75d44 100644 --- a/daemons/lvmlockd/lvmlockd-sanlock.c +++ b/daemons/lvmlockd/lvmlockd-sanlock.c @@ -2447,8 +2447,8 @@ static int release_rename(struct lockspace *ls, struct resource *r) if (!res_args) return -ENOMEM; - memcpy(&rd1, &rds->rs, sizeof(struct rd_sanlock)); - memcpy(&rd2, &rds->rs, sizeof(struct rd_sanlock)); + rd1.rs = rds->rs; + rd2.rs = rds->rs; res1 = &rd1.rs; res2 = &rd2.rs;