Your diff looks correct, though I don't think the explicit casts are needed since the prototypes are in scope. Perhaps it quiets a warning with some compiler flags?
There's a scary number of instances of min(foo, uio->uio_resid) in the kernel that should probably be fixed as well. - todd
