lkml.org 
[lkml]   [1999]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectA file lock patch
Date
Hi,

I found out these while working on NFS.

1. Shouldn't OFFSET_MAX be 0x7fffffffffffffffUL if off_t is 8 bytes?
2. The NFS testsuite expects EINVAL when length > 0 and start +
length - 1 is beyond OFFSET_MAX.

Are I am right on these?

Thanks.

--
H.J. Lu (hjl@gnu.org)
---
Index: fs/locks.c
===================================================================
RCS file: /local/work/cvs/linux/linux/fs/locks.c,v
retrieving revision 1.1.1.16
diff -u -p -r1.1.1.16 locks.c
--- locks.c 1999/01/27 00:28:56 1.1.1.16
+++ locks.c 1999/02/14 01:26:10
@@ -111,7 +111,9 @@

#include <asm/uaccess.h>

-#define OFFSET_MAX ((off_t)0x7fffffff) /* FIXME: move elsewhere? */
+/* FIXME: move elsewhere? */
+#define OFFSET_MAX ((off_t) (sizeof (off_t) == 4 \
+ ? 0x7fffffff : 0x7fffffffffffffffUL))

static int flock_make_lock(struct file *filp, struct file_lock *fl,
unsigned int cmd);
@@ -672,8 +674,11 @@ static int posix_make_lock(struct file *

if (((start += l->l_start) < 0) || (l->l_len < 0))
return (0);
+ fl->fl_end = start + l->l_len - 1;
+ if (l->l_len > 0 && fl->fl_end < 0)
+ return (0);
fl->fl_start = start; /* we record the absolute position */
- if ((l->l_len == 0) || ((fl->fl_end = start + l->l_len - 1) < 0))
+ if (l->l_len == 0)
fl->fl_end = OFFSET_MAX;

fl->fl_file = filp;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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