Module Name:    src
Committed By:   christos
Date:           Sat Jan  7 21:11:14 UTC 2017

Modified Files:
        src/sys/dev/dmover: swdmover.c

Log Message:
kill alloca in favor of ssp


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dmover/swdmover.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dmover/swdmover.c
diff -u src/sys/dev/dmover/swdmover.c:1.13 src/sys/dev/dmover/swdmover.c:1.14
--- src/sys/dev/dmover/swdmover.c:1.13	Thu Aug 20 10:40:17 2015
+++ src/sys/dev/dmover/swdmover.c	Sat Jan  7 16:11:14 2017
@@ -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 @@ swdmover_func_zero_process(struct dmover
 	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 @@ swdmover_func_zero_process(struct dmover
 		}
 
 		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 @@ swdmover_func_fill8_process(struct dmove
 	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 @@ swdmover_func_fill8_process(struct dmove
 		}
 
 		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 @@ swdmover_func_xor_process(struct dmover_
 		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 @@ swdmover_func_xor_process(struct dmover_
 		}
 
 		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 @@ swdmover_func_copy_process(struct dmover
 	    {
 		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 @@ swdmover_func_copy_process(struct dmover
 		}
 
 		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 @@ swdmover_func_iscsi_crc32c_process(struc
 	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 @@ swdmover_func_iscsi_crc32c_process(struc
 		}
 
 		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)

Reply via email to