diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 7b161573ec4ecc618a2d62ec942d548fcd6d9616..40c78ca4ca8b24b68d9a91259d003bbbab160d7c 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -50,6 +50,7 @@ static const char *sysinfoCpuinfo = "/proc/cpuinfo"; #define SYSINFO_SMBIOS_DECODER sysinfoDmidecode #define SYSINFO sysinfoSysinfo #define CPUINFO sysinfoCpuinfo +#define CPUINFO_FILE_LEN (10*1024) /* 10KB limit for /proc/cpuinfo file */ /* only to be used test programs, therefore not in sysinfo.h */ extern void virSysinfoSetup(const char *dmidecode, const char *sysinfo, @@ -223,7 +224,7 @@ virSysinfoRead(void) if (VIR_ALLOC(ret) < 0) goto no_memory; - if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL; @@ -341,7 +342,7 @@ virSysinfoRead(void) if (VIR_ALLOC(ret) < 0) goto no_memory; - if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL; @@ -470,7 +471,7 @@ virSysinfoRead(void) goto no_memory; /* Gather info from /proc/cpuinfo */ - if (virFileReadAll(CPUINFO, 8192, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL;