mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: linux-kernel@vger.kernel.org
Subject: proper way to annotate kernel use of sys_xxx?
Date: Mon, 04 Oct 2004 22:28:55 -0700	[thread overview]
Message-ID: <52u0t9u414.fsf@topspin.com> (raw)

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

             reply	other threads:[~2004-10-05  5:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05  5:28 Roland Dreier [this message]
2004-10-05  8:32 ` Arnd Bergmann
2004-10-05 17:23   ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52u0t9u414.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome