From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] sparc: fix expression with uninitialized initial value
Date: Mon, 30 Jul 2012 18:59:03 +0200 [thread overview]
Message-ID: <5016BD57.3090706@suse.de> (raw)
In-Reply-To: <CAFEAcA_cAwW7RkPFPiD_qWWScHe8=dmBQ1q83X0RpTdk6pO_qg@mail.gmail.com>
Am 30.07.2012 18:13, schrieb Peter Maydell:
> On 30 July 2012 17:04, <blauwirbel@gmail.com> wrote:
>> From: Blue Swirl <blauwirbel@gmail.com>
>>
>> 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 <blauwirbel@gmail.com>
>> ---
>> 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.
You mean the #endif part? Would an explicit err = 0 make things better?
Andreas
>
> 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 <peter.maydell@linaro.org>
>
> -- PMM
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-07-30 16:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 16:04 [Qemu-devel] [PATCH 0/5] Clang patches blauwirbel
2012-07-30 16:04 ` [Qemu-devel] [PATCH 1/5] sparc: fix floppy TC line setup blauwirbel
2012-07-30 16:04 ` [Qemu-devel] [PATCH 2/5] sparc: fix expression with uninitialized initial value blauwirbel
2012-07-30 16:13 ` Peter Maydell
2012-07-30 16:59 ` Andreas Färber [this message]
2012-07-30 17:09 ` Peter Maydell
2012-07-30 17:20 ` Blue Swirl
2012-07-30 17:57 ` Peter Maydell
2012-07-30 16:04 ` [Qemu-devel] [PATCH 3/5] qapi: avoid reserved word restrict blauwirbel
2012-07-31 7:28 ` Paolo Bonzini
2012-07-31 12:58 ` Luiz Capitulino
2012-07-31 16:56 ` Blue Swirl
2012-07-31 18:55 ` Michael Roth
2012-07-31 20:38 ` Blue Swirl
2012-07-31 22:30 ` Michael Roth
2012-08-01 6:45 ` Paolo Bonzini
2012-08-01 17:35 ` Blue Swirl
2012-08-01 0:01 ` Anthony Liguori
2012-07-30 16:04 ` [Qemu-devel] [PATCH 4/5] user: fix accidental AREG0 use blauwirbel
2012-07-30 16:04 ` [Qemu-devel] [PATCH 5/5] configure: disable a few Clang compiler warnings blauwirbel
2012-07-30 16:56 ` Stefan Weil
2012-07-30 17:23 ` Blue Swirl
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=5016BD57.3090706@suse.de \
--to=afaerber@suse.de \
--cc=blauwirbel@gmail.com \
--cc=peter.maydell@linaro.org \
--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 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.