Patchwork sparc32 fix np dereference in do_unassigned_access

login
register
mail settings
Submitter Artyom Tarasenko
Date Jan. 22, 2010, 9:31 p.m.
Message ID <1264195913-10897-1-git-send-email-atar4qemu@google.com>
Download mbox | patch
Permalink /patch/43514/
State New
Headers show

Comments

Artyom Tarasenko - Jan. 22, 2010, 9:31 p.m.
fix a potential null pointer dereference introduced in
commit	576c2cdc767ab9e2dc038fa4c99f22e53287a3de

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
Blue Swirl - Jan. 23, 2010, 8:14 a.m.
Thanks, applied.


On Fri, Jan 22, 2010 at 9:31 PM, Artyom Tarasenko
<atar4qemu@googlemail.com> wrote:
> fix a potential null pointer dereference introduced in
> commit  576c2cdc767ab9e2dc038fa4c99f22e53287a3de
>
> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
> index ce8c6f1..eb4f5a4 100644
> --- a/target-sparc/op_helper.c
> +++ b/target-sparc/op_helper.c
> @@ -3761,13 +3761,14 @@ void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
>         else
>             raise_exception(TT_DATA_ACCESS);
>     }
> -    env = saved_env;
>
>     /* flush neverland mappings created during no-fault mode,
>        so the sequential MMU faults report proper fault types */
>     if (env->mmuregs[0] & MMU_NF) {
>         tlb_flush(env, 1);
>     }
> +
> +    env = saved_env;
>  }
>  #else
>  void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
>

Patch

diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index ce8c6f1..eb4f5a4 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -3761,13 +3761,14 @@  void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
         else
             raise_exception(TT_DATA_ACCESS);
     }
-    env = saved_env;
 
     /* flush neverland mappings created during no-fault mode,
        so the sequential MMU faults report proper fault types */
     if (env->mmuregs[0] & MMU_NF) {
         tlb_flush(env, 1);
     }
+
+    env = saved_env;
 }
 #else
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,