Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 Don't use a const variable as an array si...



details:   https://anonhg.NetBSD.org/src/rev/71e16af064ea
branches:  trunk
changeset: 826555:71e16af064ea
user:      gson <gson%NetBSD.org@localhost>
date:      Tue Sep 12 14:10:49 2017 +0000

description:
Don't use a const variable as an array size, because it is not a
constant expression and will cause the array to needlessly become a
variable-size one.  Fixes "error: stack protector not protecting local
variables: variable length buffer [-Werror=stack-protector]" when
building i386 with MKDEBUG=YES -V COPTS="-g".

diffstat:

 sys/arch/i386/i386/trap.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r f1adb73cbea5 -r 71e16af064ea sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Tue Sep 12 13:43:37 2017 +0000
+++ b/sys/arch/i386/i386/trap.c Tue Sep 12 14:10:49 2017 +0000
@@ -1,5 +1,5 @@
 
-/*     $NetBSD: trap.c,v 1.289 2017/08/12 07:07:53 maxv Exp $  */
+/*     $NetBSD: trap.c,v 1.290 2017/09/12 14:10:49 gson Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.289 2017/08/12 07:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.290 2017/09/12 14:10:49 gson Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -421,7 +421,7 @@
        {
                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)];
 
                /* Check for the osyscall lcall instruction. */
                if (frame->tf_eip < VM_MAXUSER_ADDRESS - sz &&



Home | Main Index | Thread Index | Old Index