[Qemu-devel] [PATCH] altera_timer: fix incorrect memset

Paolo Bonzini posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170518103334.8808-1-pbonzini@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
hw/timer/altera_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] altera_timer: fix incorrect memset
Posted by Paolo Bonzini 6 years, 11 months ago
Use sizeof instead of ARRAY_SIZE, fixing -Wmemset-elt-size with recent
GCC versions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/timer/altera_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c
index 6d4862661d..c9a0fc5dca 100644
--- a/hw/timer/altera_timer.c
+++ b/hw/timer/altera_timer.c
@@ -204,7 +204,7 @@ static void altera_timer_reset(DeviceState *dev)
 
     ptimer_stop(t->ptimer);
     ptimer_set_limit(t->ptimer, 0xffffffff, 1);
-    memset(t->regs, 0, ARRAY_SIZE(t->regs));
+    memset(t->regs, 0, sizeof(t->regs));
 }
 
 static Property altera_timer_properties[] = {
-- 
2.13.0


Re: [Qemu-devel] [Qemu-trivial] [PATCH] altera_timer: fix incorrect memset
Posted by Laurent Vivier 6 years, 11 months ago
On 18/05/2017 12:33, Paolo Bonzini wrote:
> Use sizeof instead of ARRAY_SIZE, fixing -Wmemset-elt-size with recent
> GCC versions.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/timer/altera_timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c
> index 6d4862661d..c9a0fc5dca 100644
> --- a/hw/timer/altera_timer.c
> +++ b/hw/timer/altera_timer.c
> @@ -204,7 +204,7 @@ static void altera_timer_reset(DeviceState *dev)
>  
>      ptimer_stop(t->ptimer);
>      ptimer_set_limit(t->ptimer, 0xffffffff, 1);
> -    memset(t->regs, 0, ARRAY_SIZE(t->regs));
> +    memset(t->regs, 0, sizeof(t->regs));
>  }
>  
>  static Property altera_timer_properties[] = {
> 
Reviewed-by: Laurent Vivier <lvivier@redhat.com>


Re: [Qemu-devel] [PATCH] altera_timer: fix incorrect memset
Posted by Michael Tokarev 6 years, 11 months ago
Applied to -trivial, thanks!

/mjt