From: "Theodore Ts'o" <tytso@mit.edu>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [2.4] 64-bit write system call patch
Date: Mon, 04 Aug 2003 14:52:56 -0400 [thread overview]
Message-ID: <E19jkS0-0001na-00@think.thunk.org> (raw)
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;
reply other threads:[~2003-08-04 20:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E19jkS0-0001na-00@think.thunk.org \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox