Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ofisa don't use alloca



details:   https://anonhg.NetBSD.org/src/rev/2ae8209cb67f
branches:  trunk
changeset: 819535:2ae8209cb67f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 09 16:22:09 2016 +0000

description:
don't use alloca

diffstat:

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

diffs (37 lines):

diff -r 3222b6c99bde -r 2ae8209cb67f sys/dev/ofisa/ess_ofisa.c
--- a/sys/dev/ofisa/ess_ofisa.c Fri Dec 09 13:26:47 2016 +0000
+++ b/sys/dev/ofisa/ess_ofisa.c Fri Dec 09 16:22:09 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ess_ofisa.c,v 1.25 2010/05/22 16:35:00 tsutsui Exp $   */
+/*     $NetBSD: ess_ofisa.c,v 1.26 2016/12/09 16:22:09 christos Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess_ofisa.c,v 1.25 2010/05/22 16:35:00 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess_ofisa.c,v 1.26 2016/12/09 16:22:09 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,7 +86,6 @@
        struct ofisa_intr_desc intr[2];
        struct ofisa_dma_desc dma[2];
        int n, ndrq;
-       char *model;
 
        sc->sc_dev = self;
 
@@ -164,7 +163,9 @@
 
        n = OF_getproplen(aa->oba.oba_phandle, "model");
        if (n > 0) {
-               model = alloca(n);
+               char model[256];
+               if (n > 256)
+                       n = 256;
                if (OF_getprop(aa->oba.oba_phandle, "model", model, n) == n) {
                        aprint_normal(": %s\n", model);
                        aprint_normal_dev(self, "");



Home | Main Index | Thread Index | Old Index