[libvirt] [PATCH] S390: Buffer too small for large CPU numbers.

The output buffer for virFileReadAll was too small for systems with more than 30 CPUs which leads to a log entry and incorrect behavior. The new size will be sufficient for the current architectural limits. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/util/sysinfo.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index d38b4ff..8add936 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -361,7 +361,7 @@ virSysinfoRead(void) { goto no_memory; /* Gather info from /proc/cpuinfo */ - if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, 8192, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL; @@ -376,7 +376,7 @@ virSysinfoRead(void) { VIR_FREE(outbuf); /* Gather info from /proc/sysinfo */ - if (virFileReadAll(SYSINFO, 4096, &outbuf) < 0) { + if (virFileReadAll(SYSINFO, 8192, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), SYSINFO); return NULL; -- 1.7.0.4

On 10/05/2012 07:59 AM, Viktor Mihajlovski wrote:
The output buffer for virFileReadAll was too small for systems with more than 30 CPUs which leads to a log entry and incorrect behavior. The new size will be sufficient for the current architectural limits.
It doesn't hurt to go larger, say to 64k, if that will help prevent the need to bump this again in the future. But I'm trusting you that your choice of 8k is sufficient, as I don't have an s390 machine to test on, so: ACK and pushed.
/* Gather info from /proc/cpuinfo */ - if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, 8192, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO);
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 10/05/2012 05:04 PM, Eric Blake wrote:
It doesn't hurt to go larger, say to 64k, if that will help prevent the need to bump this again in the future. But I'm trusting you that your choice of 8k is sufficient, as I don't have an s390 machine to test on, so:
ACK and pushed.
Thanks! -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (2)
-
Eric Blake
-
Viktor Mihajlovski