diff options
author | Trond Myklebust | 2007-04-10 15:26:35 +0200 |
---|---|---|
committer | Trond Myklebust | 2007-05-01 07:17:07 +0200 |
commit | 8d5658c949e6d89edc579a1f112aeee3bc232a8e (patch) | |
tree | f206d3f6809eeb0ca23c1999cf79aa294968b113 /fs/nfs/internal.h | |
parent | NFS: Fix a race when doing NFS write coalescing (diff) | |
download | kernel-qcow2-linux-8d5658c949e6d89edc579a1f112aeee3bc232a8e.tar.gz kernel-qcow2-linux-8d5658c949e6d89edc579a1f112aeee3bc232a8e.tar.xz kernel-qcow2-linux-8d5658c949e6d89edc579a1f112aeee3bc232a8e.zip |
NFS: Fix a buffer overflow in the allocation of struct nfs_read/writedata
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r-- | fs/nfs/internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 6610f2b02077..ad2b40db1e65 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -231,3 +231,15 @@ unsigned int nfs_page_length(struct page *page) } return 0; } + +/* + * Determine the number of pages in an array of length 'len' and + * with a base offset of 'base' + */ +static inline +unsigned int nfs_page_array_len(unsigned int base, size_t len) +{ + return ((unsigned long)len + (unsigned long)base + + PAGE_SIZE - 1) >> PAGE_SHIFT; +} + |