proper way to annotate kernel use of sys_xxx?

From: Roland Dreier
Date: Tue Oct 05 2004 - 00:32:15 EST


What is the correct way to annotate kernel code that calls a sys_xxx
function that expects a __user pointer as an argument?

To give a concrete example, sparse (among lots of other warnings for
do_mounts.c) says:

init/do_mounts.c:69:16: warning: incorrect type in argument 1 (different address spaces)
init/do_mounts.c:69:16: expected char const [noderef] *filename<asn:1>
init/do_mounts.c:69:16: got char [addressable] *<noident>

The code in question is the following:

char path[64];

/* ... */

sprintf(path, "/sys/block/%s/dev", name);
fd = sys_open(path, 0, 0); /* LINE 69 */

This is an abuse of sys_open(), but we know it's OK. Is the right way
to shut up sparse to just change it to:

fd = sys_open((const char __user *) path, 0, 0);

Thanks,
Roland
-
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/