All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Tim Deegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 1/3] xen/common: Avoid undefined behaviour by shifting into a sign bit
Date: Fri, 5 Aug 2016 15:07:01 +0100	[thread overview]
Message-ID: <66230005-b8dc-8a47-0795-95bedd373425@citrix.com> (raw)
In-Reply-To: <57A4B8FE02000078001033DA@prv-mh.provo.novell.com>

On 05/08/16 15:04, Jan Beulich wrote:
>>>> On 05.08.16 at 15:50, <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/common/domctl.c
>> +++ b/xen/common/domctl.c
>> @@ -188,7 +188,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
>>          (d->controller_pause_count > 0  ? XEN_DOMINF_paused    : 0) |
>>          (d->debugger_attached           ? XEN_DOMINF_debugged  : 0) |
>>          (d->is_xenstore                 ? XEN_DOMINF_xs_domain : 0) |
>> -        d->shutdown_code << XEN_DOMINF_shutdownshift;
>> +        (unsigned int)d->shutdown_code << XEN_DOMINF_shutdownshift;
> 
> Is adding a cast here really the most suitable fix? The only two places
> shutdown_code gets set (besides the -1 initialization) have their right
> side a u8. Nothing ever checks for the value being negative (there are
> just two -1 checks), so converting the field to u8 or unsigned int (and
> using a sentinel different from -1) should both work, avoiding the need
> for a cast.

This seems sensible if possible.

The other bits:

Reviewed-by: George Dunlap <george.dunlap@citrix.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-05 14:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 13:50 [PATCH 1/3] xen/common: Avoid undefined behaviour by shifting into a sign bit Andrew Cooper
2016-08-05 13:50 ` [PATCH 2/3] xen/x86: " Andrew Cooper
2016-08-05 14:06   ` Jan Beulich
2016-08-05 13:50 ` [PATCH 3/3] x86/microcode: Avoid undefined behaviour from signed integer overflow Andrew Cooper
2016-08-05 14:09   ` Jan Beulich
2016-08-11  8:42   ` Tian, Kevin
2016-08-05 14:04 ` [PATCH 1/3] xen/common: Avoid undefined behaviour by shifting into a sign bit Jan Beulich
2016-08-05 14:07   ` George Dunlap [this message]
2016-08-09 12:48 ` [PATCH] " Andrew Cooper
2016-08-09 12:48   ` [PATCH] xen/x86: " Andrew Cooper
2016-08-09 12:48   ` [PATCH] x86/microcode: Avoid undefined behaviour from signed integer overflow Andrew Cooper
2016-08-09 14:00   ` [PATCH] xen/common: Avoid undefined behaviour by shifting into a sign bit Jan Beulich

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=66230005-b8dc-8a47-0795-95bedd373425@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.