qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification
Date: Mon, 11 Aug 2008 15:51:15 +0100
User-agent: KMail/1.9.9

> >> #define CPUID_VENDOR_INTEL_1 'Genu'
> >> ...
> >
> > Is that a real improvement? It won't make the code faster and the
> > readability doesn't improve that much either.
>
> I'd take it as a security improvement. One can easily commit a typo
> when editting magic numbers, either decimal or hexa.

I don't believe this argument at all. A bug is a bug, it's got nothing to do 
with "security".  If anything the hex values are more reliable because you 
don't have to guess how the string is converted to an integer - this is 
proved by the fact that the above suggestion is incorrect[1].  The hex values 
are given in the cpu reference docs, so there shouldn't be any doubt whether 
they are correct.

[1] As someone else mentioned (though not very clearly) gcc interprets 'Genu' 
as a big-endian value, whereas the Intel docs define "Genu" as being 
little-endian.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]