Re: [PATCH] sparse: __user annotations for ipc compat code

From: viro
Date: Fri Jun 11 2004 - 13:32:43 EST


On Fri, Jun 11, 2004 at 05:27:30PM +0200, Arnd Bergmann wrote:
> - fourth.__pad = &s64;
> + fourth.__pad = (void __user *)&s64;

That makes absolutely no sense (and should generate a warning anyway).
This is _NOT_ a userland pointer. Obviously so - we are talking about
on-stack address, for crying out loud!

> old_fs = get_fs();
> set_fs(KERNEL_DS);
> - err = sys_msgsnd(first, p, second, third);
> + err = sys_msgsnd(first, (struct msgbuf __user *)p, second, third);
> set_fs(old_fs);

Again, makes no sense whatsoever (we _still_ get a warning and clear fix
would be to get rid of set_fs() here and switch to compat_alloc_user_space()).

Same goes for the rest of patch.

Folks, warnings are not personal performance metrics, they are tools for
finding bogus code. Sigh...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/