> 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? The casts are not strictly necessary and you are correct about the warnings; both gcc (I believe since version 4.3 with the -Wconversion flag) and clang (with -Wshorten64-to-32 or -Wconversion) warn about implicit integer truncation. Apart from silencing compiler warnings, I think that having explicit casts in the souce code helps the casual reader to understand the code, as it shows, that truncation is in fact desired. That said, feel free to drop the casts from the diff if you prefer so.
> There's a scary number of instances of min(foo, uio->uio_resid) in > the kernel that should probably be fixed as well. Indeed! We have already been fixing a sizeable number of such constructs for Bitrig. As my time permits, I will continue sending diffs of this nature to this mailing list for changes I deem relevant. > > - todd cheers, natano
