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

Jiri Denemark jdenemar at redhat.com
Mon Dec 15 13:57:44 UTC 2014


On Mon, Dec 15, 2014 at 14:16:31 +0100, Boris Fiuczynski wrote:
> 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;

I don't think this needs to be S390 specific. Why can't we just increase
CPUINFO_FILE_LEN to, e.g., 1MB?

Jirka




More information about the libvir-list mailing list