qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] a5cf82: scsi, pci, qdev, isa-bus, sysbus: don


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] a5cf82: scsi, pci, qdev, isa-bus, sysbus: don't let *_get_...
Date: Fri, 05 Oct 2012 14:30:16 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: a5cf8262e4eb9c4646434e2c6211ef8608db3233
      
https://github.com/qemu/qemu/commit/a5cf8262e4eb9c4646434e2c6211ef8608db3233
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/ide/qdev.c
    M hw/isa-bus.c
    M hw/pci.c
    M hw/qdev.c
    M hw/scsi-bus.c
    M hw/sysbus.c

  Log Message:
  -----------
  scsi, pci, qdev, isa-bus, sysbus: don't let *_get_fw_dev_path return NULL

Use g_strdup rather than strdup, because the sole caller
(qdev_get_fw_dev_path_helper) assumes it gets non-NULL, and dereferences
it.  Besides, in that caller, the allocated buffer is already freed with
g_free, so it's better to allocate with a matching g_strdup.

In one case, (scsi-bus.c) it was trivial, so I replaced an snprintf+
g_strdup combination with an equivalent g_strdup_printf use.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: bfad67399bcca8c1afbbc93593d365044d92f7c6
      
https://github.com/qemu/qemu/commit/bfad67399bcca8c1afbbc93593d365044d92f7c6
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M target-sparc/cpu.c

  Log Message:
  -----------
  sparc: use g_strdup in place of unchecked strdup

This avoids a NULL-deref upon strdup failure.
Also update matching free to g_free.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: c2cba3d9314f972dfaf724d0ec2d018eb54c95f1
      
https://github.com/qemu/qemu/commit/c2cba3d9314f972dfaf724d0ec2d018eb54c95f1
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: avoid buffer overrun by using pstrcpy, not strncpy

Also, use PATH_MAX, rather than the arbitrary 1024.
Using PATH_MAX is more consistent with other filename-related
variables in this file, like backing_filename and tmp_filename.

Acked-by: Kevin Wolf <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 3178e2755ec5a7fb1afe583fb6ac2622c2c42184
      
https://github.com/qemu/qemu/commit/3178e2755ec5a7fb1afe583fb6ac2622c2c42184
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M block/sheepdog.c

  Log Message:
  -----------
  sheepdog: avoid a few buffer overruns

* parse_vdiname: Use pstrcpy, not strncpy, when the destination
buffer must be NUL-terminated.
* sd_open: Likewise, avoid buffer overrun.
* do_sd_create: Likewise.  Leave the preceding memset, since
pstrcpy does not NUL-fill, and filename needs that.
* sd_snapshot_create: Add a comment/question.
* find_vdi_name: Remove a useless memset.
* sd_snapshot_goto: Remove a useless memset.
Use pstrcpy to NUL-terminate, because find_vdi_name requires
that its vdi arg (filename parameter) be NUL-terminated.
It seems ok not to NUL-fill the buffer.
Do the same for snapid: remove useless memset-0 (instead,
zero tag[0]).  Use pstrcpy, not strncpy.
* sd_snapshot_list: Use pstrcpy, not strncpy to write
into the ->name member.  Each must be NUL-terminated.

Acked-by: Kevin Wolf <address@hidden>
Acked-by: MORITA Kazutaka <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: d66f8e7bd3de4a2ecf0680c635f870f2138425b8
      
https://github.com/qemu/qemu/commit/d66f8e7bd3de4a2ecf0680c635f870f2138425b8
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M block/vmdk.c

  Log Message:
  -----------
  vmdk: relative_path: use pstrcpy in place of strncpy

Avoid strncpy+manual-NUL-terminate.  Use pstrcpy instead.

Acked-by: Kevin Wolf <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: a79b5f8b80890b402fdb0733b0a073695a7875b5
      
https://github.com/qemu/qemu/commit/a79b5f8b80890b402fdb0733b0a073695a7875b5
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/9pfs/virtio-9p-synth.c

  Log Message:
  -----------
  hw/9pfs: avoid buffer overrun

v9fs_add_dir_node and qemu_v9fs_synth_add_file used strncpy
to form node->name, which requires NUL-termination, but
strncpy does not ensure NUL-termination.
Use pstrcpy, which does.

Acked-by: Aneesh Kumar K.V <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 1044dc1118d9a90e2aa324047bea9c91c889e28f
      
https://github.com/qemu/qemu/commit/1044dc1118d9a90e2aa324047bea9c91c889e28f
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/lm32_hwsetup.h

  Log Message:
  -----------
  lm32: avoid buffer overrun

Actually do what the comment says, using pstrcpy NUL-terminate:
strncpy does not always do that.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 3eadc68ebd174f5bad51fe6e0bbcf6d6651c784c
      
https://github.com/qemu/qemu/commit/3eadc68ebd174f5bad51fe6e0bbcf6d6651c784c
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M os-posix.c

  Log Message:
  -----------
  os-posix: avoid buffer overrun

os_set_proc_name: Use pstrcpy, in place of strncpy and the
ineffectual preceding assignment: name[sizeof(name) - 1] = 0;

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: ae2150680190e510dcbcdfdbfb3a54369c75367f
      
https://github.com/qemu/qemu/commit/ae2150680190e510dcbcdfdbfb3a54369c75367f
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M target-ppc/kvm.c

  Log Message:
  -----------
  ppc: avoid buffer overrun: use pstrcpy, not strncpy

A terminal NUL is required by caller's use of strchr.
It's better not to use strncpy at all, since there is no need
to zero out hundreds of trailing bytes for each iteration.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 900cfbcac6fa689b5fc8d53b60c3ed39047b8a33
      
https://github.com/qemu/qemu/commit/900cfbcac6fa689b5fc8d53b60c3ed39047b8a33
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user: remove two unchecked uses of strdup

Remove two uses of strdup (use g_path_get_basename instead),
and add a comment that this strncpy use is ok.

Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 5847d9e1399d3497be8eeca6f3a20a18a40b114b
      
https://github.com/qemu/qemu/commit/5847d9e1399d3497be8eeca6f3a20a18a40b114b
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M ui/vnc-auth-sasl.c

  Log Message:
  -----------
  ui/vnc: simplify and avoid strncpy

Don't bother with strncpy.  There's no need for its zero-fill.
Use g_strndup in place of g_malloc+strncpy+NUL-terminate.

Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: e5fda03839e3c61b01d6c60de5625501d01c69d0
      
https://github.com/qemu/qemu/commit/e5fda03839e3c61b01d6c60de5625501d01c69d0
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/bt-hci.c

  Log Message:
  -----------
  bt: replace fragile snprintf use and unwarranted strncpy

In bt_hci_name_req a failed snprintf could return len larger than
sizeof(params.name), which means the following memset call would
have a "length" value of (size_t)-1, -2, etc...  Sounds scary.
But currently, one can deduce that there is no problem:
strlen(slave->lmp_name) is guaranteed to be smaller than
CHANGE_LOCAL_NAME_CP_SIZE, which is the same as sizeof(params.name),
so this cannot happen.  Regardless, there is no justification for
using snprintf+memset.  Use pstrcpy instead.

Also, in bt_hci_event_complete_read_local_name, use pstrcpy in place
of unwarranted strncpy.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 9238c2099d37748a4e2cbbe709ed1ebffa6f3c8b
      
https://github.com/qemu/qemu/commit/9238c2099d37748a4e2cbbe709ed1ebffa6f3c8b
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/9pfs/virtio-9p-posix-acl.c
    M hw/9pfs/virtio-9p-xattr-user.c
    M hw/9pfs/virtio-9p-xattr.c

  Log Message:
  -----------
  virtio-9p: avoid unwarranted uses of strncpy

In all of these cases, the uses of strncpy were unnecessary, since
at each point of use we know that the NUL-terminated source bytes
fit in the destination buffer.  Use memcpy in place of strncpy.

Acked-by: Aneesh Kumar K.V <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 9d055d8ac83cfd590263e8862ff683f705dfdf56
      
https://github.com/qemu/qemu/commit/9d055d8ac83cfd590263e8862ff683f705dfdf56
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/spapr_vscsi.c

  Log Message:
  -----------
  vscsi: avoid unwarranted strncpy

Don't use strncpy when the source string is known to fit
in the destination buffer.  Use equivalent memcpy.
We could even use strcpy, here, but some static analyzers
warn about that, so don't add new uses.

Acked-by: David Gibson <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 1ab516ed9b6ba00bafc5ca37604f8af4680323ca
      
https://github.com/qemu/qemu/commit/1ab516ed9b6ba00bafc5ca37604f8af4680323ca
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M qga/commands-posix.c

  Log Message:
  -----------
  qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name

NUL-termination of the .ifr_name field is not required, but is fine
(and preferable to using strncpy and leaving the reader to wonder),
since the first thing the linux kernel does is to clear the last byte.
Besides, using pstrcpy here makes this setting of ifr_name consistent
with the other code (e.g., net/tap-linux.c) that does the same thing.

Reviewed-by: Luiz Capitulino <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 2e679780ae86c6ca8bc81efe0a376a0b99b09b8f
      
https://github.com/qemu/qemu/commit/2e679780ae86c6ca8bc81efe0a376a0b99b09b8f
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M libcacard/Makefile
    M libcacard/vcard_emul_nss.c

  Log Message:
  -----------
  libcacard/vcard_emul_nss: use pstrcpy in place of strncpy

Replace strncpy+NUL-terminate use with use of pstrcpy.
This requires linking with cutils.o (or else vssclient doesn't link),
so add that in the Makefile.

Acked-by: Alon Levy <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 3cda346269784c234c7a296ff6851f36a1a9189d
      
https://github.com/qemu/qemu/commit/3cda346269784c234c7a296ff6851f36a1a9189d
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/acpi.c

  Log Message:
  -----------
  acpi: remove strzcpy (strncpy-identical) function; just use strncpy

Adjust all uses s/strzcpy/strncpy/ and mark these uses
of strncpy as "ok".

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 00ea188125f6ee33e6beaff5da878fa9478e6a0d
      
https://github.com/qemu/qemu/commit/00ea188125f6ee33e6beaff5da878fa9478e6a0d
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: mark this file's sole strncpy use as justified

Acked-by: Kevin Wolf <address@hidden>
Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 9310b9be14f73d4c1e98bfa315fe84326ad9e8e7
      
https://github.com/qemu/qemu/commit/9310b9be14f73d4c1e98bfa315fe84326ad9e8e7
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/r2d.c

  Log Message:
  -----------
  hw/r2d: add comment: this strncpy use is ok

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 9b9e3ec1b47f615f635055924e24705cc3f45b20
      
https://github.com/qemu/qemu/commit/9b9e3ec1b47f615f635055924e24705cc3f45b20
  Author: Jim Meyering <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M HACKING

  Log Message:
  -----------
  doc: update HACKING wrt strncpy/pstrcpy

Reword the section on strncpy: its NUL-filling is important
in some cases.  Mention that pstrcpy's signature is different.

Signed-off-by: Jim Meyering <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 610b823ef66b993660f1ab1447a769f190e4f3b3
      
https://github.com/qemu/qemu/commit/610b823ef66b993660f1ab1447a769f190e4f3b3
  Author: Stefan Weil <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M qemu-barrier.h

  Log Message:
  -----------
  qemu-barrier: Fix compiler version check for future gcc versions

The current check will give a wrong result for gcc-5.x with x < 4.
Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

Signed-off-by: Stefan Weil <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: e0fea6b1e4df2067a51e08e67a17cb98a547287c
      
https://github.com/qemu/qemu/commit/e0fea6b1e4df2067a51e08e67a17cb98a547287c
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M tests/libqtest.c

  Log Message:
  -----------
  qtest: implement QTEST_STOP

It is quite difficult to debug qtest test cases without extra wrapper
scripts for QEMU or similar.  This patch adds a simple environment
variable-based trigger that sends a STOP signal to the QEMU instance
under test, before attempting to connect to its QMP session.

This will block execution of the testcase and give time to attach a
debugger to the stopped QEMU process.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: b6db4aca20e9af4f62c9c9e08b9b9672a6ed3390
      
https://github.com/qemu/qemu/commit/b6db4aca20e9af4f62c9c9e08b9b9672a6ed3390
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M cutils.c
    M tests/rtc-test.c

  Log Message:
  -----------
  rtc: fix overflow in mktimegm

When setting a date in 1980, Linux is actually disregarding the century
byte and setting the year to 2080.  This causes a year-2038 overflow
in mktimegm.  Fix this by doing the days-to-seconds computation in
64-bit math.

Reported-by: Lucas Meneghel Rodrigues <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: e67edb943f0c812530aaae2491da56f9542f928b
      
https://github.com/qemu/qemu/commit/e67edb943f0c812530aaae2491da56f9542f928b
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/mc146818rtc.c
    M hw/mc146818rtc_regs.h

  Log Message:
  -----------
  rtc: map CMOS index 0x37 to 0x32 on read and writes

QEMU's attempt to implement the century byte cover two possible places
for the byte.  A common one on modern chipsets is 0x32, but QEMU also
stores the value in 0x37 (apparently for IBM PS/2 compatibility---it's
only been 25 years).  To simplify the implementation of the century
byte, store it only at 0x32 but remap transparently 0x37 to 0x32 when
reading and writing from CMOS.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: b8994faf2a8d6fc791669bb432bdb3a7a1711013
      
https://github.com/qemu/qemu/commit/b8994faf2a8d6fc791669bb432bdb3a7a1711013
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M hw/mc146818rtc.c
    M tests/rtc-test.c

  Log Message:
  -----------
  rtc: implement century byte

Implement the century byte in the RTC emulation, and test that it works.
This leads to some annoying compatibility code because we need to treat
a value of 2000 for the base_year property as "use the century byte
properly" (which would be a value of 0).

The century byte will now be always-zero, rather than always-20,
for the MIPS Magnum machine whose base_year is 1980.  Commit 42fc73a
(Support epoch of 1980 in RTC emulation for MIPS Magnum, 2009-01-24)
correctly said:

    With an epoch of 1980 and a year of 2009, one could argue that [the
    century byte] should hold either 0, 1, 19 or 20.  NT 3.50 on MIPS
    does not read the century byte.

so I picked the simplest and most sensible implementation which is to
return 0 for 1980-2079, 1 for 2080-2179 and so on.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: c9159fe9aa9abe24115ea4d16127179e9cb07e22
      
https://github.com/qemu/qemu/commit/c9159fe9aa9abe24115ea4d16127179e9cb07e22
  Author: Stefan Weil <address@hidden>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M .gitignore
    M Makefile
    R Makefile.hw
    M Makefile.objs
    M Makefile.target
    M configure
    M hw/9pfs/Makefile.objs
    M hw/Makefile.objs
    M hw/ide/Makefile.objs
    M hw/usb/Makefile.objs

  Log Message:
  -----------
  Remove libhw

The entries for libhw* are no longer needed in .gitignore.

There is also no longer a difference between common-obj-y and
hw-obj-y, so one of those two macros is sufficient.

Signed-off-by: Stefan Weil <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


Compare: https://github.com/qemu/qemu/compare/a14c74928ba1...c9159fe9aa9a

reply via email to

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