Skip to contentSkip to conversation

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

Qemu-devel dcb 2 participants 3 messages Jan 28, 2017 – Oct 3, 2017

lore
Share & tools
lore

dcb

author
#0 lore raw

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));

** Affects: qemu
Importance: Undecided
Status: New

Signature · 25 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1660035

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

Status in QEMU:
  New

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));

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1660035/+subscriptions
#1 lore raw
Quoted 6 lines · dcb

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]

Quoted 7 lines

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

#2 lore raw
In reply to dcb

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

Signature · 25 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1660035

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

Status in QEMU:
  Fix Released

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));

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1660035/+subscriptions