hw/timer/altera_timer.c:207: bad size in memset ?

Bug #1660035 reported by dcb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

hw/timer/altera_timer.c:207:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

Source code is

     memset(t->regs, 0, ARRAY_SIZE(t->regs));

Maybe better code

     memset(t->regs, 0, R_MAX * sizeof( uint32_t));

Revision history for this message
Peter Maydell (pmaydell) wrote : Re: [Qemu-devel] [Bug 1660035] [NEW] hw/timer/altera_timer.c:207: bad size in memset ?

On 28 January 2017 at 13:16, dcb <email address hidden> wrote:
> Public bug reported:
>
> hw/timer/altera_timer.c:207:5: warning: ‘memset’ used with length equal
> to number of elements without multiplication by element size [-Wmemset-
> elt-size]
>
> Source code is
>
> memset(t->regs, 0, ARRAY_SIZE(t->regs));
>
> Maybe better code
>
> memset(t->regs, 0, R_MAX * sizeof( uint32_t));

Better still -- just memset(t->regs, 0, sizeof(t->regs));

Chris, could you send a patch to fix this, please?

thanks
-- PMM

Revision history for this message
Thomas Huth (th-huth) wrote :

This problem should have been fixed with QEMU v2.10.0:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=cc16ee9d4ecec35ea04e

Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.