diff mbox series

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

Message ID 20220214095441.23390-1-liwei.song@windriver.com
State New
Headers show
Series [rt-tests] rt-migrate-test: increase the buf size to 2048 when parse cpuinfo | expand

Commit Message

Liwei Song Feb. 14, 2022, 9:54 a.m. UTC
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@windriver.com>
---
 src/rt-migrate-test/rt-migrate-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

John Kacur Feb. 15, 2022, 10:09 p.m. UTC | #1
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@windriver.com>
> ---
>  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@redhat.com>
diff mbox series

Patch

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;