don't use alloca

This commit is contained in:
christos 2016-12-09 16:22:09 +00:00
parent efb3a6b68d
commit e084f4b0b4

View File

@ -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 @@ ess_ofisa_attach(device_t parent, device_t self, void *aux)
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 @@ ess_ofisa_attach(device_t parent, device_t self, void *aux)
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, "");