diff mbox

[11/14] linux-user: fpu_save_addr is not used

Message ID 60dd6cb1f888183df83a2d6b6b98e17c5991a093.1307014902.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela June 2, 2011, 11:53 a.m. UTC
It is only read to set the error code?

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 linux-user/signal.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Peter Maydell June 2, 2011, 1:51 p.m. UTC | #1
On 2 June 2011 12:53, Juan Quintela <quintela@redhat.com> wrote:
> It is only read to set the error code?

>         err |= __get_user(fpu_save_addr, &sf->fpu_save);
> -
> +        (void)fpu_save_addr;

In linux-user __get_user can never generate an error: faults
are always caught by the lock_user_struct() or equivalent call
done beforehand. The error handling is I think a leftover from
code borrowed from the kernel (which does have a __get_user
that might return an error).

So I think the correct fix here is just to remove the __get_user
lines and the variables if they're not used.

-- PMM
Juan Quintela June 2, 2011, 2:59 p.m. UTC | #2
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 2 June 2011 12:53, Juan Quintela <quintela@redhat.com> wrote:
>> It is only read to set the error code?
>
>>         err |= __get_user(fpu_save_addr, &sf->fpu_save);
>> -
>> +        (void)fpu_save_addr;
>
> In linux-user __get_user can never generate an error: faults
> are always caught by the lock_user_struct() or equivalent call
> done beforehand. The error handling is I think a leftover from
> code borrowed from the kernel (which does have a __get_user
> that might return an error).
>
> So I think the correct fix here is just to remove the __get_user
> lines and the variables if they're not used.

Fine with me.  Will do for next series.

Later, Juan.
diff mbox

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index c7a375f..edf4cdb 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -2122,7 +2122,7 @@  long do_sigreturn(CPUState *env)
 	}

         err |= __get_user(fpu_save_addr, &sf->fpu_save);
-
+        (void)fpu_save_addr;
         //if (fpu_save)
         //        err |= restore_fpu_state(env, fpu_save);

@@ -2295,6 +2295,7 @@  void sparc64_set_context(CPUSPARCState *env)
                  abi_ulong) != 0)
         goto do_sigsegv;
     err |= __get_user(fenab, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_enab));
+    (void)fenab;
     err |= __get_user(env->fprs, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_fprs));
     {
         uint32_t *src, *dst;