[libvirt] [PATCH] S390: Fix virSysinfoRead memory corruption

Daniel P. Berrange berrange at redhat.com
Fri Dec 7 09:44:42 UTC 2012


On Fri, Dec 07, 2012 at 09:44:35AM +0100, Viktor Mihajlovski wrote:
> 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.
> 
> BTW: I hit an issue with using strchr(string,variable), as I am
> still compiling with gcc 4.4.x, see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
> I circumvented this using index(), which is deprecated, but working.
> 
> Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
>  src/util/sysinfo.c |  160 ++++++++++++++++++++++-----------------------------
>  1 files changed, 69 insertions(+), 91 deletions(-)

Given the complexity the parsing it would be nice to add a test
case for this. It is a shame we don't already have a test case
for the sysinfo code in fact :-( I'd like to see test/virsysinfotest.c
to validate this parsing. Take a 'char *str' containing representation
data from /proc/sysinfo, run it through the parser & then validate the
result.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list