Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dmover kill alloca in favor of ssp
details: https://anonhg.NetBSD.org/src/rev/3e9f241f963c
branches: trunk
changeset: 350221:3e9f241f963c
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 07 21:11:14 2017 +0000
description:
kill alloca in favor of ssp
diffstat:
sys/dev/dmover/swdmover.c | 40 +++++++++++++++++-----------------------
1 files changed, 17 insertions(+), 23 deletions(-)
diffs (124 lines):
diff -r e31a6dbad539 -r 3e9f241f963c sys/dev/dmover/swdmover.c
--- a/sys/dev/dmover/swdmover.c Sat Jan 07 20:49:23 2017 +0000
+++ b/sys/dev/dmover/swdmover.c Sat Jan 07 21:11:14 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: swdmover.c,v 1.13 2015/08/20 14:40:17 christos Exp $ */
+/* $NetBSD: swdmover.c,v 1.14 2017/01/07 21:11:14 christos Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: swdmover.c,v 1.13 2015/08/20 14:40:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swdmover.c,v 1.14 2017/01/07 21:11:14 christos Exp $");
#include <sys/param.h>
#include <sys/kthread.h>
@@ -147,7 +147,7 @@
case DMOVER_BUF_UIO:
{
struct uio *uio = dreq->dreq_outbuf.dmbuf_uio;
- char *cp;
+ char cp[1024];
size_t count, buflen;
int error;
@@ -160,9 +160,8 @@
}
buflen = uio->uio_resid;
- if (buflen > 1024)
- buflen = 1024;
- cp = alloca(buflen);
+ if (buflen > sizeof(cp))
+ buflen = sizeof(cp);
memset(cp, 0, buflen);
while ((count = uio->uio_resid) != 0) {
@@ -209,7 +208,7 @@
case DMOVER_BUF_UIO:
{
struct uio *uio = dreq->dreq_outbuf.dmbuf_uio;
- char *cp;
+ char cp[1024];
size_t count, buflen;
int error;
@@ -222,9 +221,8 @@
}
buflen = uio->uio_resid;
- if (buflen > 1024)
- buflen = 1024;
- cp = alloca(buflen);
+ if (buflen > sizeof(cp))
+ buflen = sizeof(cp);
memset(cp, dreq->dreq_immediate[0], buflen);
while ((count = uio->uio_resid) != 0) {
@@ -334,7 +332,7 @@
struct uio *uio_out = dreq->dreq_outbuf.dmbuf_uio;
struct uio *uio_in = dreq->dreq_inbuf[0].dmbuf_uio;
struct uio *uio;
- char *cp, *dst;
+ char cp[1024], dst[1024];
size_t count, buflen;
int error;
@@ -349,10 +347,8 @@
}
buflen = uio_in->uio_resid;
- if (buflen > 1024)
- buflen = 1024;
- cp = alloca(buflen);
- dst = alloca(buflen);
+ if (buflen > sizeof(cp))
+ buflen = sizeof(cp);
/*
* For each block, copy first input buffer into the destination
@@ -440,7 +436,7 @@
{
struct uio *uio_out = dreq->dreq_outbuf.dmbuf_uio;
struct uio *uio_in = dreq->dreq_inbuf[0].dmbuf_uio;
- char *cp;
+ char cp[1024];
size_t count, buflen;
int error;
@@ -455,9 +451,8 @@
}
buflen = uio_in->uio_resid;
- if (buflen > 1024)
- buflen = 1024;
- cp = alloca(buflen);
+ if (buflen > sizeof(cp))
+ buflen = sizeof(cp);
while ((count = uio_in->uio_resid) != 0) {
if (count > buflen)
@@ -595,7 +590,7 @@
case DMOVER_BUF_UIO:
{
struct uio *uio_in = dreq->dreq_inbuf[0].dmbuf_uio;
- uint8_t *cp;
+ uint8_t cp[1024];
size_t count, buflen;
int error;
@@ -608,9 +603,8 @@
}
buflen = uio_in->uio_resid;
- if (buflen > 1024)
- buflen = 1024;
- cp = alloca(buflen);
+ if (buflen > sizeof(cp))
+ buflen = sizeof(cp);
while ((count = uio_in->uio_resid) != 0) {
if (count > buflen)
Home |
Main Index |
Thread Index |
Old Index