qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] target-mips: fix call to memset in soft reset c


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] target-mips: fix call to memset in soft reset code
Date: Mon, 9 May 2016 19:53:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0

Am 09.05.2016 um 18:44 schrieb Aurelien Jarno:
> Recent versions of GCC report the following error when compiling
> target-mips/helper.c:
> 
>   qemu/target-mips/helper.c:542:9: warning: ‘memset’ used with length
>   equal to number of elements without multiplication by element size
>   [-Wmemset-elt-size]
> 
> This is indeed correct and due to a wrong usage of sizeof(). Fix that.
> 
> Cc: Stefan Weil <address@hidden>
> Cc: Leon Alrae <address@hidden>
> LP: https://bugs.launchpad.net/qemu/+bug/1577841
> Signed-off-by: Aurelien Jarno <address@hidden>
> ---
>  target-mips/helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target-mips/helper.c b/target-mips/helper.c
> index 1004ede..cfea177 100644
> --- a/target-mips/helper.c
> +++ b/target-mips/helper.c
> @@ -539,7 +539,7 @@ void mips_cpu_do_interrupt(CPUState *cs)
>          break;
>      case EXCP_SRESET:
>          env->CP0_Status |= (1 << CP0St_SR);
> -        memset(env->CP0_WatchLo, 0, sizeof(*env->CP0_WatchLo));
> +        memset(env->CP0_WatchLo, 0, sizeof(env->CP0_WatchLo));
>          goto set_error_EPC;
>      case EXCP_NMI:
>          env->CP0_Status |= (1 << CP0St_NMI);
> 

Reviewed-by: Stefan Weil <address@hidden>

I suggest to apply this patch to 2.6, if this is still possible:

* It is a very small modification which fixes a bug.
* It fixes a new build error with recent gcc versions.

The first reason alone would not justify it for 2.6 as this
is a rather old bug.

Stefan




reply via email to

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