sanlock: fix struct copy to avoid aliasing issues
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 10 Jul 2025 13:11:30 +0000 (15:11 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 13 Jul 2025 15:16:20 +0000 (17:16 +0200)
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

index 137526dd1294777728b52eec4b61a9f6d5d382b7..48ed75d442bcbfbd6c2b5b4eabfc1391a6f4de88 100644 (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;
This page took 0.070928 seconds and 5 git commands to generate.