raid/cpu: Use memcpy() instead of type punning

The vendor may not be suitably aligned for uint32_t *.

Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
This commit is contained in:
Tavian Barnes 2024-06-21 16:11:52 -04:00 committed by Kent Overstreet
parent 8b06995115
commit 53d7722563

View File

@ -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, &reg[1], 4);
memcpy(vendor + 4, &reg[3], 4);
memcpy(vendor + 8, &reg[2], 4);
vendor[12] = 0;
raid_cpuid(1, 0, reg);