patch-2.4.0-test1 linux/fs/super.c
Next file: linux/fs/ufs/super.c
Previous file: linux/fs/partitions/msdos.c
Back to the patch index
Back to the overall index
- Lines: 33
- Date:
Wed May 24 08:34:32 2000
- Orig file:
v2.3.99-pre9/linux/fs/super.c
- Orig date:
Tue May 23 15:31:36 2000
diff -u --recursive --new-file v2.3.99-pre9/linux/fs/super.c linux/fs/super.c
@@ -1167,7 +1167,8 @@
{
int i;
unsigned long page;
-
+ unsigned long size;
+
*where = 0;
if (!data)
return 0;
@@ -1179,13 +1180,18 @@
* gave us is valid. Just in case, we'll zero
* the remainder of the page.
*/
- i = copy_from_user((void *)page, data, PAGE_SIZE);
- if (i == PAGE_SIZE) {
+ /* copy_from_user cannot cross TASK_SIZE ! */
+ size = TASK_SIZE - (unsigned long)data;
+ if (size > PAGE_SIZE)
+ size = PAGE_SIZE;
+
+ i = size - copy_from_user((void *)page, data, size);
+ if (!i) {
free_page(page);
return -EFAULT;
}
- if (i)
- memset((char *)page + PAGE_SIZE - i, 0, i);
+ if (i != PAGE_SIZE)
+ memset((char *)page + i, 0, PAGE_SIZE - i);
*where = page;
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)