1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-02 04:22:02 +03:00

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: e9640e5178
as unintended side effect.
This commit is contained in:
Zdenek Kabelac
2025-07-10 15:11:30 +02:00
parent bd26e768ef
commit b86b1da80a

View File

@ -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;