Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern sys_memfd: Fix logic errors for offset in the previ...
details: https://anonhg.NetBSD.org/src/rev/14ca59cc3c9a
branches: trunk
changeset: 378332:14ca59cc3c9a
user: rin <rin%NetBSD.org@localhost>
date: Sat Jul 29 23:51:29 2023 +0000
description:
sys_memfd: Fix logic errors for offset in the previous.
diffstat:
sys/kern/sys_memfd.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (34 lines):
diff -r 06755fcd1afe -r 14ca59cc3c9a sys/kern/sys_memfd.c
--- a/sys/kern/sys_memfd.c Sat Jul 29 23:50:03 2023 +0000
+++ b/sys/kern/sys_memfd.c Sat Jul 29 23:51:29 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_memfd.c,v 1.6 2023/07/29 17:54:54 christos Exp $ */
+/* $NetBSD: sys_memfd.c,v 1.7 2023/07/29 23:51:29 rin Exp $ */
/*-
* Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_memfd.c,v 1.6 2023/07/29 17:54:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_memfd.c,v 1.7 2023/07/29 23:51:29 rin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -160,12 +160,12 @@ memfd_read(file_t *fp, off_t *offp, stru
goto leave;
}
- if (flags & FOF_UPDATE_OFFSET)
- *offp = uio->uio_offset;
+ uio->uio_offset = *offp;
todo = MIN(uio->uio_resid, mfd->mfd_size - *offp);
error = ubc_uiomove(mfd->mfd_uobj, uio, todo, UVM_ADV_SEQUENTIAL,
UBC_READ|UBC_PARTIALOK);
- *offp = uio->uio_offset;
+ if (flags & FOF_UPDATE_OFFSET)
+ *offp = uio->uio_offset;
leave:
getnanotime(&mfd->mfd_atime);
Home |
Main Index |
Thread Index |
Old Index