lkml.org 
[lkml]   [2003]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] [2.4] 64-bit write system call patch
From
Date
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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.018 / U:2.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site