]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/i386/cpu: Avoid mixing signed and unsigned in property setters
authorMarkus Armbruster <armbru@redhat.com>
Thu, 10 Oct 2024 15:01:41 +0000 (17:01 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 18 Oct 2024 13:03:35 +0000 (15:03 +0200)
commitf91cf8175bd40142a2dfddbd8e761b8ca1adc30f
treee7e2dbda56b8175007416b4299cd1161a259cb6a
parent5551449bb8e58d0dacb43b3d436b201b28324ee9
target/i386/cpu: Avoid mixing signed and unsigned in property setters

Properties "family", "model", and "stepping" are visited as signed
integers.  They are backed by bits in CPUX86State member
@cpuid_version.  The code to extract and insert these bits mixes
signed and unsigned.  Not actually wrong, but avoiding such mixing is
good practice.

Visit them as unsigned integers instead.

This adds a few mildly ugly cast in arguments of error_setg().  The
next commit will get rid of them again.

Property "tsc-frequency" is also visited as signed integer.  The value
ultimately flows into the kernel, where it is 31 bits unsigned.  The
QEMU code freely mixes int, uint32_t, int64_t.  I elect not to attempt
draining this swamp today.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20241010150144.986655-5-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
target/i386/cpu.c