From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] x86/HVM: change the flags cpu context field to uint64_t
Date: Mon, 18 Jan 2016 17:33:38 +0100 [thread overview]
Message-ID: <569D13E2.7030202@citrix.com> (raw)
In-Reply-To: <569D1FD202000078000C8202@prv-mh.provo.novell.com>
El 18/01/16 a les 17.24, Jan Beulich ha escrit:
>>>> On 18.01.16 at 16:38, <roger.pau@citrix.com> wrote:
>> El 18/01/16 a les 16.24, Andrew Cooper ha escrit:
>>> On 18/01/16 15:21, Jan Beulich wrote:
>>>>>>> On 18.01.16 at 16:09, <roger.pau@citrix.com> wrote:
>>>>> --- a/xen/include/public/arch-x86/hvm/save.h
>>>>> +++ b/xen/include/public/arch-x86/hvm/save.h
>>>>> @@ -161,8 +161,8 @@ struct hvm_hw_cpu {
>>>>> uint32_t error_code;
>>>>>
>>>>> #define _XEN_X86_FPU_INITIALISED 0
>>>>> -#define XEN_X86_FPU_INITIALISED (1U<<_XEN_X86_FPU_INITIALISED)
>>>>> - uint32_t flags;
>>>>> +#define XEN_X86_FPU_INITIALISED (1UL<<_XEN_X86_FPU_INITIALISED)
>>>>> + uint64_t flags;
>>>>> };
>>>> How is the UL going to make this safe for a 32-bit consumer?
>>>> Makes me think that, other than just said in reply to v1, it'll
>>>> indeed be better to have a separate field (with a separate
>>>> zero-check)... The (undesirable imo) alternative being to use
>>>> 1L instead.
>>>
>>> I am happy either way. My R-b stands.
>>
>> What about using ULL or simply casting to uint64_t?
>
> ULL might not be supported by pre-C99 compilers. Casting to
> uint64_t is, well, ugly. The flags field really has no business
> being wider then 32 bits.
Right, although Xen uses gnu99 this is a public header.
You should see a v3 somewhere with a proper check for the padding filed.
While doing this I've also realised that the padding fields in the other
structs in the same file don't seem to be checked at all.
Roger.
next prev parent reply other threads:[~2016-01-18 16:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 12:10 [xen-unstable test] 78395: regressions - FAIL osstest service owner
2016-01-18 12:55 ` Jan Beulich
2016-01-18 14:39 ` [PATCH] x86/HVM: add padding to hvm_hw_cpu Roger Pau Monne
2016-01-18 14:47 ` Andrew Cooper
2016-01-18 15:09 ` [PATCH v2] x86/HVM: change the flags cpu context field to uint64_t Roger Pau Monne
2016-01-18 15:11 ` Andrew Cooper
2016-01-18 15:21 ` Jan Beulich
2016-01-18 15:24 ` Andrew Cooper
2016-01-18 15:38 ` Roger Pau Monné
2016-01-18 16:24 ` Jan Beulich
2016-01-18 16:33 ` Roger Pau Monné [this message]
2016-01-18 16:43 ` Jan Beulich
2016-01-18 15:17 ` [PATCH] x86/HVM: add padding to hvm_hw_cpu Jan Beulich
2016-01-18 16:25 ` [PATCH v3] x86/HVM: add padding to struct hvm_hw_cpu Roger Pau Monne
2016-01-19 15:13 ` Jan Beulich
2016-01-19 15:21 ` Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569D13E2.7030202@citrix.com \
--to=roger.pau@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.