linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [2.4] 64-bit write system call patch
@ 2003-08-04 18:52 Theodore Ts'o
  0 siblings, 0 replies; only message in thread
From: Theodore Ts'o @ 2003-08-04 18:52 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

Hi Marcello,

The following patch (the BK Linux 2.4 tree) is needed to fix some
32/64-bit issues with the write system call.  There are a number of
places in the VFS stack (and in ext2/3 filesystem --- possibly others,
but I haven't had the time to audit them yet) where the number of bytes
written assigned to an integer instead of a ssize_t.  This causes the
top 32-bits of the returned value to get lopped off, so that a write()
of 4 gigabytes returns 0 instead of 4GB.

The patch is fairly straightforward, and obvious(tm).  Please apply.

						- Ted

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1052  -> 1.1053 
#	        mm/filemap.c	1.85    -> 1.86   
#	      fs/ext3/file.c	1.3     -> 1.4    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/03	tytso@think.thunk.org	1.1053
# Fix 32/64 bit issues.
# --------------------------------------------
#
diff -Nru a/fs/ext3/file.c b/fs/ext3/file.c
--- a/fs/ext3/file.c	Mon Aug  4 14:47:00 2003
+++ b/fs/ext3/file.c	Mon Aug  4 14:47:00 2003
@@ -61,7 +61,8 @@
 static ssize_t
 ext3_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
-	int ret, err;
+	ssize_t ret;
+	int err;
 	struct inode *inode = file->f_dentry->d_inode;
 
 	ret = generic_file_write(file, buf, count, ppos);
diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c	Mon Aug  4 14:47:00 2003
+++ b/mm/filemap.c	Mon Aug  4 14:47:00 2003
@@ -3108,7 +3108,7 @@
 	struct page	*page, *cached_page;
 	ssize_t		written;
 	long		status = 0;
-	int		err;
+	ssize_t		err;
 	unsigned	bytes;
 
 	cached_page = NULL;
@@ -3229,7 +3229,7 @@
 	loff_t		pos;
 	ssize_t		written;
 	long		status = 0;
-	int		err;
+	ssize_t		err;
 
 	pos = *ppos;
 	written = 0;
@@ -3270,7 +3270,8 @@
 static int do_odirect_fallback(struct file *file, struct inode *inode,
 			       const char *buf, size_t count, loff_t *ppos)
 {
-	int ret, err;
+	ssize_t ret;
+	int err;
 
 	down(&inode->i_sem);
 	ret = do_generic_file_write(file, buf, count, ppos);
@@ -3287,7 +3288,7 @@
 generic_file_write(struct file *file,const char *buf,size_t count, loff_t *ppos)
 {
 	struct inode	*inode = file->f_dentry->d_inode->i_mapping->host;
-	int		err;
+	ssize_t		err;
 
 	if ((ssize_t) count < 0)
 		return -EINVAL;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-04 20:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04 18:52 [PATCH] [2.4] 64-bit write system call patch Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).