Commit a94a0bb4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i2o: 64-bit fixes

From: Markus Lidel <Markus.Lidel@shadowconnect.com>

Fix 64-bit problems.
parent 8c95df95
...@@ -875,7 +875,9 @@ static int ioctl_passthru(unsigned long arg) ...@@ -875,7 +875,9 @@ static int ioctl_passthru(unsigned long arg)
/* Copy in the user's I2O command */ /* Copy in the user's I2O command */
if(copy_from_user((void*)msg, (void*)user_msg, size)) if(copy_from_user((void*)msg, (void*)user_msg, size))
return -EFAULT; return -EFAULT;
get_user(reply_size, &user_reply[0]); if(get_user(reply_size, &user_reply[0]) < 0)
return -EFAULT;
reply_size = reply_size>>16; reply_size = reply_size>>16;
reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL); reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL);
if(!reply) { if(!reply) {
...@@ -889,6 +891,10 @@ static int ioctl_passthru(unsigned long arg) ...@@ -889,6 +891,10 @@ static int ioctl_passthru(unsigned long arg)
memset(sg_list,0, sizeof(sg_list[0])*SG_TABLESIZE); memset(sg_list,0, sizeof(sg_list[0])*SG_TABLESIZE);
if(sg_offset) { if(sg_offset) {
if(sg_offset * 4 >= size) {
rcode = -EFAULT;
goto cleanup;
}
// TODO 64bit fix // TODO 64bit fix
struct sg_simple_element *sg = (struct sg_simple_element*) (msg+sg_offset); struct sg_simple_element *sg = (struct sg_simple_element*) (msg+sg_offset);
sg_count = (size - sg_offset*4) / sizeof(struct sg_simple_element); sg_count = (size - sg_offset*4) / sizeof(struct sg_simple_element);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment