xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86: fix bug_line()
Date: Fri, 11 Oct 2013 18:17:20 +0100	[thread overview]
Message-ID: <CE7DF130.3938E%keir.xen@gmail.com> (raw)
In-Reply-To: <5258349A02000078000FAA6E@nat28.tlf.novell.com>

On 11/10/2013 16:25, "Jan Beulich" <JBeulich@suse.com> wrote:

> Due to the packing into a bit field together with a relocated field,
> the computation can overflow when the relocated field ends up getting a
> negative value stored. Hence it isn't sufficient to correct the value
> by 1 in this case, but we also need to mask the result to the width of
> the original bit field.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/include/asm-x86/bug.h
> +++ b/xen/include/asm-x86/bug.h
> @@ -15,9 +15,11 @@ struct bug_frame {
>  
>  #define bug_loc(b) ((const void *)(b) + (b)->loc_disp)
>  #define bug_ptr(b) ((const void *)(b) + (b)->ptr_disp)
> -#define bug_line(b) ((((b)->line_hi + ((b)->loc_disp < 0)) <<
> \
> +#define bug_line(b) (((((b)->line_hi + ((b)->loc_disp < 0)) &
> \
> +                       ((1 << BUG_LINE_HI_WIDTH) - 1)) <<
> \
>                        BUG_LINE_LO_WIDTH) +
> \
> -                     (b)->line_lo + ((b)->ptr_disp < 0))
> +                     (((b)->line_lo + ((b)->ptr_disp < 0)) &
> \
> +                      ((1 << BUG_LINE_LO_WIDTH) - 1)))
>  #define bug_msg(b) ((const char *)(b) + (b)->msg_disp[1])
>  
>  #define BUGFRAME_run_fn 0
> 
> 
> 

      reply	other threads:[~2013-10-11 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 15:25 [PATCH] x86: fix bug_line() Jan Beulich
2013-10-11 17:17 ` Keir Fraser [this message]

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=CE7DF130.3938E%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=JBeulich@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).