Module Name:    src
Committed By:   kamil
Date:           Wed Sep 18 20:18:27 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: trap.c

Log Message:
Avoid VLA to appease stack-protector

This has been reproduced with -O0 and -fsanitize=undefined.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/amd64/amd64/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.123 src/sys/arch/amd64/amd64/trap.c:1.124
--- src/sys/arch/amd64/amd64/trap.c:1.123	Wed Aug 21 17:14:05 2019
+++ src/sys/arch/amd64/amd64/trap.c	Wed Sep 18 20:18:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.123 2019/08/21 17:14:05 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.124 2019/09/18 20:18:27 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.123 2019/08/21 17:14:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.124 2019/09/18 20:18:27 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -351,7 +351,7 @@ trap(struct trapframe *frame)
 	{
 		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
 		const size_t sz = sizeof(lcall);
-		char tmp[sz];
+		char tmp[sizeof(lcall) /* Avoids VLA */];
 
 		/* Check for the oosyscall lcall instruction. */
 		if (p->p_emul == &emul_netbsd32 &&

Reply via email to