From 53d77225638bb3cb77fbc36a9e2383d568f228ad Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 21 Jun 2024 16:11:52 -0400 Subject: [PATCH] raid/cpu: Use memcpy() instead of type punning The vendor may not be suitably aligned for uint32_t *. Signed-off-by: Tavian Barnes --- raid/cpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raid/cpu.h b/raid/cpu.h index ed909bb7..164ac8ce 100644 --- a/raid/cpu.h +++ b/raid/cpu.h @@ -57,9 +57,9 @@ static inline void raid_cpu_info(char *vendor, unsigned *family, unsigned *model raid_cpuid(0, 0, reg); - ((uint32_t*)vendor)[0] = reg[1]; - ((uint32_t*)vendor)[1] = reg[3]; - ((uint32_t*)vendor)[2] = reg[2]; + memcpy(vendor, ®[1], 4); + memcpy(vendor + 4, ®[3], 4); + memcpy(vendor + 8, ®[2], 4); vendor[12] = 0; raid_cpuid(1, 0, reg);