qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: edgar.iglesias@gmail.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/6] linux-user: Fix trampoline code for CRIS
Date: Mon, 3 Feb 2014 12:49:57 +0200	[thread overview]
Message-ID: <20140203104957.GA17799@afflict.kos.to> (raw)
In-Reply-To: <1391310292-18008-7-git-send-email-edgar.iglesias@gmail.com>

On Sun, Feb 02, 2014 at 03:04:52AM +0000, edgar.iglesias@gmail.com wrote:
> From: Stefan Weil <sw@weilnetz.de>
> 
> __put_user can write bytes, words (2 bytes) or longwords (4 bytes).
> Here obviously words should have been written, but bytes were written,
> so values like 0x9c5f were truncated to 0x5f.
> 
> Fix this by changing retcode from uint8_t to to uint16_t in
> target_signal_frame and also in the unused rt_signal_frame.
> 
> This problem was reported by static code analysis (smatch).

Acked-by: Riku Voipio <riku.voipio@linaro.org>

> Cc: qemu-stable@nongnu.org
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  linux-user/signal.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 01d7c39..82e8592 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -3659,7 +3659,7 @@ struct target_sigcontext {
>  struct target_signal_frame {
>          struct target_sigcontext sc;
>          uint32_t extramask[TARGET_NSIG_WORDS - 1];
> -        uint8_t retcode[8];       /* Trampoline code. */
> +        uint16_t retcode[4];      /* Trampoline code. */
>  };
>  
>  struct rt_signal_frame {
> @@ -3667,7 +3667,7 @@ struct rt_signal_frame {
>          void *puc;
>          siginfo_t info;
>          struct ucontext uc;
> -        uint8_t retcode[8];       /* Trampoline code. */
> +        uint16_t retcode[4];      /* Trampoline code. */
>  };
>  
>  static void setup_sigcontext(struct target_sigcontext *sc, CPUCRISState *env)
> @@ -3745,8 +3745,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
>  	 */
>  	err |= __put_user(0x9c5f, frame->retcode+0);
>  	err |= __put_user(TARGET_NR_sigreturn, 
> -			  frame->retcode+2);
> -	err |= __put_user(0xe93d, frame->retcode+4);
> +			  frame->retcode + 1);
> +	err |= __put_user(0xe93d, frame->retcode + 2);
>  
>  	/* Save the mask.  */
>  	err |= __put_user(set->sig[0], &frame->sc.oldmask);
> -- 
> 1.8.3.2
> 

      reply	other threads:[~2014-02-03 10:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02  3:04 [Qemu-devel] [PATCH 0/6] CRIS queue edgar.iglesias
2014-02-02  3:04 ` [Qemu-devel] [PATCH 1/6] cris: Add a CRISv32 default "any" CPU for user mode emulation edgar.iglesias
2014-02-03 11:02   ` Riku Voipio
2014-02-03 12:12     ` Edgar E. Iglesias
2014-02-03 11:44   ` Andreas Färber
2014-02-03 13:22     ` Edgar E. Iglesias
2014-02-02  3:04 ` [Qemu-devel] [PATCH 2/6] cris: Abort when a v10 takes interrupts while in a delayslot edgar.iglesias
2014-02-02  3:04 ` [Qemu-devel] [PATCH 3/6] cris: Add interrupt signals to the CPU device edgar.iglesias
2014-02-02 23:54   ` Peter Crosthwaite
2014-02-02  3:04 ` [Qemu-devel] [PATCH 4/6] axis-dev88: Connect the PIC upstream IRQs directly to the CPU edgar.iglesias
2014-02-02 23:54   ` Peter Crosthwaite
2014-02-02  3:04 ` [Qemu-devel] [PATCH 5/6] cris: Remove the CRIS PIC glue edgar.iglesias
2014-02-02 23:54   ` Peter Crosthwaite
2014-02-02  3:04 ` [Qemu-devel] [PATCH 6/6] linux-user: Fix trampoline code for CRIS edgar.iglesias
2014-02-03 10:49   ` Riku Voipio [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=20140203104957.GA17799@afflict.kos.to \
    --to=riku.voipio@iki.fi \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.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).