Re: [PATCH rt-tests] rt-migrate-test: increase the buf size to 2048 when parse cpuinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 14 Feb 2022, Liwei Song wrote:

> When parse /proc/cpuinfo, the size of "flags" may exceed 1024,
> this will cause "realloc(): invalid next size" error, increase
> the buf size to 2048 to fix this case.
> 
> Signed-off-by: Liwei Song <liwei.song@xxxxxxxxxxxxx>
> ---
>  src/rt-migrate-test/rt-migrate-test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 62cc603c983b..883e60e21bff 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -497,14 +497,14 @@ static void stop_log(int sig)
>  static int count_cpus(void)
>  {
>  	FILE *fp;
> -	char buf[1024];
> +	char buf[2048];
>  	int cpus = 0;
>  	char *pbuf;
>  	size_t *pn;
>  	size_t n;
>  	int r;
>  
> -	n = 1024;
> +	n = 2048;
>  	pn = &n;
>  	pbuf = buf;
>  
> -- 
> 2.17.1

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux