qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/5] sparc: fix expression with uninitialized in


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/5] sparc: fix expression with uninitialized initial value
Date: Mon, 30 Jul 2012 17:13:43 +0100

On 30 July 2012 17:04,  <address@hidden> wrote:
> From: Blue Swirl <address@hidden>
>
> err was uninitalized, it's not OK to use |=. Spotted by Clang

"uninitialized" (feel free to just fix typo on commit).

> compiler.
>
> Fix by replacing |= by =.
>
> Signed-off-by: Blue Swirl <address@hidden>
> ---
>  linux-user/signal.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 97f30d9..3d6b5df 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -2061,7 +2061,7 @@ restore_fpu_state(CPUSPARCState *env, 
> qemu_siginfo_fpu_t *fpu)
>          err = __copy_from_user(&env->fpr[0], &fpu->si_float_regs[0],
>                                      (sizeof(unsigned long) * 32));
>  #endif
> -        err |= __get_user(env->fsr, &fpu->si_fsr);
> +        err = __get_user(env->fsr, &fpu->si_fsr);
>  #if 0
>          err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
>          if (current->thread.fpqdepth != 0)

This will need changing again if we ever fix the #if 0-d out
code in this function, but I guess that will be obvious to whoever
does that.

Incidentally, __get_user() can never fail [we catch unreadable memory
earlier when wo do the lock_user_struct] so you could also just
not do anything with its return value. Some of the other targets
rely on this in their signal save/restore code. I think the use
of the return value is mostly in code that was copy-and-pasted
from the Linux kernel (which does use a __get_user() that can fail).

Reviewed-by: Peter Maydell <address@hidden>

-- PMM



reply via email to

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