1. 11 4月, 2017 1 次提交
  2. 08 3月, 2017 2 次提交
    • J
      util: Avoid possible NULL dereference in virSysinfoParsePPCProcessor · 15b88147
      John Ferlan 提交于
      Found by Coverity. Because there's an "if ((cur = strstr(base, "revision"))
       != NULL) {" followed by a "base = cur" coverity notes that 'base' could
      then be NULL causing the return to the top of the "while ((tmp_base =
      strstr(base, "processor")) != NULL) {" to have strstr deref a NULL 'base'
      pointer because the setting of base at the bottom of the loop is unconditional.
      
      Alter the code to set "base = cur" after processing each key. That will
      "ensure" that base doesn't get set to NULL if both "cpu" and "revision"
      do no follow a "processor".
      
      While a /proc/cpuinfo file that has a "processor" key but with neither
      a "cpu" nor a "revision" doesn't seem feasible, the code is written as if
      it could happen, so we have to account for it.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      15b88147
    • J
      util: Resource some resource leaks in virsysinfo code · 7744d994
      John Ferlan 提交于
      Calls to virFileReadAll after a VIR_ALLOC that return NULL all show
      a memory leak since 'ret' isn't virSysinfoDefFree'd and normal path
      "return ret" doesn't free outbuf.
      
      Reported by Coverity
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      7744d994
  3. 07 3月, 2017 2 次提交
  4. 11 4月, 2016 1 次提交
  5. 18 6月, 2015 1 次提交
  6. 12 6月, 2015 3 次提交
    • M
      virsysinfo: s/system/sysdef/ · c1dff918
      Michal Privoznik 提交于
      A variable can't be named system, obviously. Well, it can if the
      compiler is new enough to distinguish a variable named system and a
      function call system(). And some older systems, don't have wise
      compiler.
      
        CC     util/libvirt_util_la-virsysinfo.lo
      cc1: warnings being treated as errors
      ../../src/util/virsysinfo.c: In function 'virSysinfoParseSystem':
      ../../src/util/virsysinfo.c:649: error: declaration of 'system' shadows a global declaration [-Wshadow]
      /usr/include/stdlib.h:717: error: shadowed declaration is here [-Wshadow]
      make[3]: *** [util/libvirt_util_la-virsysinfo.lo] Error 1
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c1dff918
    • M
      virSysinfoDef: Exempt SYSTEM variables · 0b92974c
      Michal Privoznik 提交于
      Move all the system_* fields into a separate struct. Not only this
      simplifies the code a bit it also helps us to identify whether BIOS
      info is present. We don't have to check all the four variables for
      being not-NULL, but we can just check the pointer to the struct.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0b92974c
    • M
      virSysinfoDef: Exempt BIOS variables · 3f9cae18
      Michal Privoznik 提交于
      Move all the bios_* fields into a separate struct. Not only this
      simplifies the code a bit it also helps us to identify whether BIOS
      info is present. We don't have to check all the four variables for
      being not-NULL, but we can just check the pointer to the struct.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3f9cae18
  7. 27 5月, 2015 1 次提交
  8. 22 5月, 2015 1 次提交
    • M
      sysinfo: Fix reports on ARM · 85128e29
      Michal Privoznik 提交于
      Due to a kernel commit (b4b8f770e), cpuinfo format has changed on
      ARMs. Firstly, 'Processor: ...' may not be reported, it's
      replaced by 'model name: ...'. Secondly, the "Processor" string
      may occur in CPU name, e.g. 'ARMv7 Processor rev 5 (v7l)'.
      Therefore, we must firstly look for 'model name' and then for
      'Processor' if not found.
      Moreover, lines in the cpuinfo file are shuffled, so we better
      not manipulate the pointer to start of internal buffer as we may
      lost some info.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      85128e29
  9. 13 5月, 2015 1 次提交
  10. 18 12月, 2014 1 次提交
  11. 15 11月, 2014 1 次提交
  12. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  13. 04 4月, 2014 1 次提交
  14. 25 3月, 2014 1 次提交
  15. 21 3月, 2014 1 次提交
  16. 18 3月, 2014 1 次提交
  17. 14 3月, 2014 1 次提交
  18. 21 1月, 2014 1 次提交
    • R
      Use AC_PATH_PROG to search for dmidecode · 881c6c00
      Roman Bogorodskiy 提交于
      This is useful in certain circumstances, for example when
      libvirtd is being executed by FreeBSD rc script, it cannot find
      dmidecode installed from FreeBSD ports because it doesn't have
      /usr/local (default prefix for ports) in PATH.
      881c6c00
  19. 20 1月, 2014 1 次提交
  20. 21 11月, 2013 1 次提交
    • E
      maint: fix comma style issues: util · c7c84fa5
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/util/vircommand.c: Consistently use commas.
      * src/util/virlog.c: Likewise.
      * src/util/virnetdevbandwidth.c: Likewise.
      * src/util/virnetdevmacvlan.c: Likewise.
      * src/util/virnetdevvportprofile.c: Likewise.
      * src/util/virnetlink.c: Likewise.
      * src/util/virpci.c: Likewise.
      * src/util/virsysinfo.c: Likewise.
      * src/util/virusb.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c7c84fa5
  21. 16 10月, 2013 1 次提交
  22. 11 7月, 2013 1 次提交
  23. 10 7月, 2013 1 次提交
  24. 28 5月, 2013 1 次提交
    • E
      syntax: prefer space after semicolon in for loop · 146ba114
      Eric Blake 提交于
      I noticed several unusual spacings in for loops, and decided to
      fix them up.  See the next commit for the syntax check that found
      all of these.
      
      * examples/domsuspend/suspend.c (main): Fix spacing.
      * python/libvirt-override.c: Likewise.
      * src/conf/interface_conf.c: Likewise.
      * src/security/virt-aa-helper.c: Likewise.
      * src/util/virconf.c: Likewise.
      * src/util/virhook.c: Likewise.
      * src/util/virlog.c: Likewise.
      * src/util/virsocketaddr.c: Likewise.
      * src/util/virsysinfo.c: Likewise.
      * src/util/viruuid.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
      default case, to let compiler check us.
      * tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      146ba114
  25. 24 5月, 2013 1 次提交
  26. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  27. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  28. 04 4月, 2013 1 次提交
  29. 21 12月, 2012 6 次提交
  30. 18 12月, 2012 1 次提交
    • V
      S390: Fix virSysinfoRead memory corruption · cab938c9
      Viktor Mihajlovski 提交于
      There was a double free issue caused by virSysinfoRead on s390,
      as the same manufacturer string instance was assigned to more
      than one processor record.
      Cleaned up other potential memory issues and restructured the sysinfo
      parsing code by moving repeating patterns into a helper function.
      
      The restructuring made it necessary to conditionally disable
      -Wlogical-op for some older GCC versions, using pragma GCC diagnostic.
      This is a GCC specific pragma, which is acceptable, since we're
      using it to work around a GCC specific bug.
      
      Finally, added a function virSysinfoSetup to configure the sysinfo
      data source files/script during run time, to facilitate writing test
      programs. This function is not published in sysinfo.h and only
      there for testing.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      cab938c9
  31. 02 11月, 2012 1 次提交