Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c appease -Werror=stack-protector by avoiding vari...



details:   https://anonhg.NetBSD.org/src/rev/e50f20872058
branches:  trunk
changeset: 965728:e50f20872058
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sun Sep 29 05:35:29 2019 +0000

description:
appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64

diffstat:

 sys/dev/i2c/ds1307.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 9d8fb581e381 -r e50f20872058 sys/dev/i2c/ds1307.c
--- a/sys/dev/i2c/ds1307.c      Sun Sep 29 05:28:21 2019 +0000
+++ b/sys/dev/i2c/ds1307.c      Sun Sep 29 05:35:29 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $     */
+/*     $NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -775,8 +775,9 @@
 dsrtc_clock_write_timeval(struct dsrtc_softc *sc, time_t t)
 {
        const struct dsrtc_model * const dm = &sc->sc_model;
-       size_t buflen = dm->dm_rtc_size + 2; 
-       uint8_t buf[buflen];
+       size_t buflen = dm->dm_rtc_size + 2;
+       /* XXX: the biggest dm_rtc_size we have now is 7, so we should be ok */ 
+       uint8_t buf[16];
        int error;
 
        KASSERT((dm->dm_flags & DSRTC_FLAG_CLOCK_HOLD) == 0);



Home | Main Index | Thread Index | Old Index