[PATCH i-g-t 10/26] Fix size of EXEC

Petri Latvala petri.latvala at intel.com
Fri Mar 12 11:03:25 UTC 2021


---
 lib/runnercomms.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/runnercomms.c b/lib/runnercomms.c
index 950e5373..fc657cff 100644
--- a/lib/runnercomms.c
+++ b/lib/runnercomms.c
@@ -249,11 +249,11 @@ struct runnerpacket *runnerpacket_exec(char **argv)
 	char *p;
 	int i;
 
-	size = 0;
+	size = sizeof(struct runnerpacket);
+
 	for (i = 0; argv[i] != NULL; i++)
 		size += strlen(argv[i]) + 1; // followed by a space of \0 so +1 either way for each
 
-	size += sizeof(struct runnerpacket);
 	packet = malloc(size);
 
 	packet->size = size;
@@ -264,10 +264,11 @@ struct runnerpacket *runnerpacket_exec(char **argv)
 	p = packet->data;
 
 	for (i = 0; argv[i] != NULL; i++) {
+		if (i != 0)
+			*p++ = ' ';
+
 		strcpy(p, argv[i]);
 		p += strlen(argv[i]);
-		p[0] = ' ';
-		p++;
 	}
 	p[0] = '\0';
 
-- 
2.29.2



More information about the Intel-gfx-trybot mailing list