[PATCH 0/5] alloc: Don't mask use of uninitialized variables in VIR_FREE

Peter Krempa posted 5 patches 4 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1583401776.git.pkrempa@redhat.com
src/conf/virnetworkportdef.c | 19 +++++++------------
src/libvirt_private.syms     |  1 -
src/lxc/lxc_process.c        |  3 +--
src/util/viralloc.c          | 21 ++-------------------
src/util/viralloc.h          |  7 +------
tests/qemumonitorjsontest.c  | 14 +++++---------
tools/virsh-domain.c         | 18 ++++++------------
7 files changed, 22 insertions(+), 61 deletions(-)
[PATCH 0/5] alloc: Don't mask use of uninitialized variables in VIR_FREE
Posted by Peter Krempa 4 years, 1 month ago
Neither GCC nor clang report warnings if pointer passed to VIR_FREE is
uninitialized. This is probably caused by our internal implementation
which mangles the pointer to it.

Fix all offenders and replace VIR_FREE's internals with g_clear_pointer.

Peter Krempa (5):
  virNetworkPortDefSaveStatus: Fix potentially uninitialized 'path' by
    refactoring cleanup
  virLXCProcessSetupNamespaceName: Fix potential uninitialized free of
    'path'
  cmdDomHostname: Fix uninitialized use of 'hostname' by refactoring
    cleanup
  testQemuMonitorJSONqemuMonitorJSONGetTargetArch: Fix uninitialized use
    of 'arch'
  VIR_ALLOC: Replace internals by g_clear_pointer

 src/conf/virnetworkportdef.c | 19 +++++++------------
 src/libvirt_private.syms     |  1 -
 src/lxc/lxc_process.c        |  3 +--
 src/util/viralloc.c          | 21 ++-------------------
 src/util/viralloc.h          |  7 +------
 tests/qemumonitorjsontest.c  | 14 +++++---------
 tools/virsh-domain.c         | 18 ++++++------------
 7 files changed, 22 insertions(+), 61 deletions(-)

-- 
2.24.1

Re: [PATCH 0/5] alloc: Don't mask use of uninitialized variables in VIR_FREE
Posted by Ján Tomko 4 years, 1 month ago
On a Thursday in 2020, Peter Krempa wrote:
>Neither GCC nor clang report warnings if pointer passed to VIR_FREE is
>uninitialized. This is probably caused by our internal implementation
>which mangles the pointer to it.
>
>Fix all offenders and replace VIR_FREE's internals with g_clear_pointer.
>
>Peter Krempa (5):
>  virNetworkPortDefSaveStatus: Fix potentially uninitialized 'path' by
>    refactoring cleanup
>  virLXCProcessSetupNamespaceName: Fix potential uninitialized free of
>    'path'
>  cmdDomHostname: Fix uninitialized use of 'hostname' by refactoring
>    cleanup
>  testQemuMonitorJSONqemuMonitorJSONGetTargetArch: Fix uninitialized use
>    of 'arch'
>  VIR_ALLOC: Replace internals by g_clear_pointer
>
> src/conf/virnetworkportdef.c | 19 +++++++------------
> src/libvirt_private.syms     |  1 -
> src/lxc/lxc_process.c        |  3 +--
> src/util/viralloc.c          | 21 ++-------------------
> src/util/viralloc.h          |  7 +------
> tests/qemumonitorjsontest.c  | 14 +++++---------
> tools/virsh-domain.c         | 18 ++++++------------
> 7 files changed, 22 insertions(+), 61 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano