NFS: Fix a buffer overflow in the allocation of struct nfs_read/writedata
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user