[libvirt] [PATCH] Buffer size too small when reading sysinfo on S390

Boris Fiuczynski fiuczy at linux.vnet.ibm.com
Mon Dec 15 13:16:31 UTC 2014


On a system with 160 CPUs the /proc/cpuinfo size grows beyond
the currently set limit of 10KB causing an internal error.

This patch increases the buffer size for S390 to 64KB.

Signed-off-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
---
 src/util/virsysinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 1bb6392..613bab9 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -377,6 +377,8 @@ virSysinfoRead(void)
 #  pragma GCC diagnostic ignored "-Wlogical-op"
 # endif
 
+# define S390_CPUINFO_FILE_LEN (64*1024) /* 64KB limit for /proc/cpuinfo file */
+
 static char *
 virSysinfoParseDelimited(const char *base, const char *name, char **value,
                          char delim1, char delim2)
@@ -471,7 +473,7 @@ virSysinfoRead(void)
         goto no_memory;
 
     /* Gather info from /proc/cpuinfo */
-    if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) {
+    if (virFileReadAll(CPUINFO, S390_CPUINFO_FILE_LEN, &outbuf) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Failed to open %s"), CPUINFO);
         return NULL;
-- 
1.9.3





More information about the libvir-list mailing list