Source-Changes-HG archive

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

[src/trunk]: src/sys/kern sys___aio_suspend50, sys_lio_listio:



details:   https://anonhg.NetBSD.org/src/rev/4c9b2d10f626
branches:  trunk
changeset: 748085:4c9b2d10f626
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Oct 12 23:43:13 2009 +0000

description:
sys___aio_suspend50, sys_lio_listio:
        - fix the buffer sizes.
        - use kmem_alloc instead of kmem_zalloc for buffers which we will
          overwrite soon.

diffstat:

 sys/kern/sys_aio.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r 2b2b62b4295a -r 4c9b2d10f626 sys/kern/sys_aio.c
--- a/sys/kern/sys_aio.c        Mon Oct 12 23:43:05 2009 +0000
+++ b/sys/kern/sys_aio.c        Mon Oct 12 23:43:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_aio.c,v 1.27 2009/10/12 23:38:08 yamt Exp $        */
+/*     $NetBSD: sys_aio.c,v 1.28 2009/10/12 23:43:13 yamt Exp $        */
 
 /*
  * Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.27 2009/10/12 23:38:08 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.28 2009/10/12 23:43:13 yamt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -831,13 +831,13 @@
                if (error)
                        return error;
        }
-       list = kmem_zalloc(nent * sizeof(struct aio_job), KM_SLEEP);
-       error = copyin(SCARG(uap, list), list, nent * sizeof(struct aiocb));
+       list = kmem_alloc(nent * sizeof(*list), KM_SLEEP);
+       error = copyin(SCARG(uap, list), list, nent * sizeof(*list));
        if (error)
                goto out;
        error = aio_suspend1(l, list, nent, SCARG(uap, timeout) ? &ts : NULL);
 out:
-       kmem_free(list, nent * sizeof(struct aio_job));
+       kmem_free(list, nent * sizeof(*list));
        return error;
 }
 
@@ -991,9 +991,9 @@
        }
 
        /* Get the list from user-space */
-       aiocbp_list = kmem_zalloc(nent * sizeof(struct aio_job), KM_SLEEP);
+       aiocbp_list = kmem_alloc(nent * sizeof(*aiocbp_list), KM_SLEEP);
        error = copyin(SCARG(uap, list), aiocbp_list,
-           nent * sizeof(struct aiocb));
+           nent * sizeof(*aiocbp_list));
        if (error) {
                mutex_enter(&aio->aio_mtx);
                goto err;
@@ -1038,7 +1038,7 @@
                aio_sendsig(p, &lio->sig);
                pool_put(&aio_lio_pool, lio);
        }
-       kmem_free(aiocbp_list, nent * sizeof(struct aio_job));
+       kmem_free(aiocbp_list, nent * sizeof(*aiocbp_list));
        return error;
 }
 



Home | Main Index | Thread Index | Old Index