Messages in this thread | ![/](/images/icornerl.gif) | | Date | Mon, 29 Sep 2003 09:44:50 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] autofs sparse fixes |
| |
For cases like this, where we use a kernel pointer and do the "set_fs(KERNEL_DS)" thing to mak ea user-pointer routing write to kernel space, I suggest casting the pointer instead of the function, along with a comment on the "set_fs()".
Basically, something like this instead:
static int autofs_write(struct file *file, const void *addr, int bytes) { const void __user *data; ...
set_fs(KERNEL_DS); /* This cast is legal due to the set_fs()! */ data = (const void __user *) addr;
...->write(file, data, bytes); set_fs(old_fs); }
See? That makes the cast more obvious, and it also makes it obvious _why_ the cast from kernel->user pointer is ok in this case.
Linus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |