Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/fs/msdosfs Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/0ed4b65eb198
branches: netbsd-2-0
changeset: 564847:0ed4b65eb198
user: riz <riz%NetBSD.org@localhost>
date: Tue Sep 06 16:11:14 2005 +0000
description:
Pull up following revision(s) (requested by xtraeme in ticket #5627):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.17
sys/fs/msdosfs/denode.h: revision 1.6
The maximum file size on MS-DOS filesystems is 4 GB - 1 byte, so
don't bother trying to write files bigger than this. Just return
EFBIG to caller, rather than panic()ing later.
>From OpenBSD.
This closes my PR kern/30864: "panic when copying files of >4GB on
msdosfs"
diffstat:
sys/fs/msdosfs/denode.h | 5 ++++-
sys/fs/msdosfs/msdosfs_vnops.c | 8 ++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diffs (48 lines):
diff -r 9021e14e626d -r 0ed4b65eb198 sys/fs/msdosfs/denode.h
--- a/sys/fs/msdosfs/denode.h Tue Sep 06 01:34:51 2005 +0000
+++ b/sys/fs/msdosfs/denode.h Tue Sep 06 16:11:14 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: denode.h,v 1.4 2003/09/07 22:09:11 itojun Exp $ */
+/* $NetBSD: denode.h,v 1.4.2.1 2005/09/06 16:11:14 riz Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -177,6 +177,9 @@
*/
#define WIN_MAXLEN 255
+/* Maximum size of a file on a FAT filesystem */
+#define MSDOSFS_FILESIZE_MAX 0xFFFFFFFFLL
+
/*
* Transfer directory entries between internal and external form.
* dep is a struct denode * (internal form),
diff -r 9021e14e626d -r 0ed4b65eb198 sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c Tue Sep 06 01:34:51 2005 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c Tue Sep 06 16:11:14 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vnops.c,v 1.9 2004/01/26 10:39:30 hannken Exp $ */
+/* $NetBSD: msdosfs_vnops.c,v 1.9.2.1 2005/09/06 16:11:14 riz Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.9 2004/01/26 10:39:30 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.9.2.1 2005/09/06 16:11:14 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -596,6 +596,10 @@
if (uio->uio_resid == 0)
return (0);
+ /* Don't bother to try to write files larger than the fs limit */
+ if (uio->uio_offset + uio->uio_resid > MSDOSFS_FILESIZE_MAX)
+ return (EFBIG);
+
/*
* If they've exceeded their filesize limit, tell them about it.
*/
Home |
Main Index |
Thread Index |
Old Index