From: Keith Owens <kaos@ocs.com.au>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sparse annotation question
Date: Wed, 12 Jul 2006 16:42:44 +1000 [thread overview]
Message-ID: <28491.1152686564@kao2.melbourne.sgi.com> (raw)
In-Reply-To: Your message of "Tue, 11 Jul 2006 23:14:09 MST." <20060711.231409.121242621.davem@davemloft.net>
David Miller (on Tue, 11 Jul 2006 23:14:09 -0700 (PDT)) wrote:
>From: Keith Owens <kaos@ocs.com.au>
>Date: Wed, 12 Jul 2006 15:47:03 +1000
>
>> func (long regno, unsigned long *contents)
>> {
>> unsigned long i, *bsp;
>> mm_segment_t old_fs;
>> bsp = <expression involving only kernel variables>;
>> old_fs = set_fs(KERNEL_DS);
>> for (i = 0; i < (regno - 32); ++i)
>> bsp = ia64_rse_skip_regs(bsp, 1);
>> put_user(*contents, bsp);
>> set_fs(old_fs);
>> }
>>
>> sparse is complaining that the second parameter to put_user() is not
>> marked as __user. How do I tell sparse to ignore this case? Marking
>> bsp as __user does not work, sparse then complains about incorrect type
>> in assignment (different address spaces).
>
>Since, in this case, you "know what you are doing" you can force the
>matter by using the __force keyword as well as __user.
I tried various combinations of __force, but kept getting this:
warning: incorrect type in argument 1 (different address spaces)
expected unsigned long *addr
got unsigned long [noderef] [force] *[addressable] bsp<asn:1>
What finally worked was
unsigned long i, *bsp, __user *ubsp;
...
ubsp = (unsigned long __user *) bsp;
put_user(*contents, ubsp);
next prev parent reply other threads:[~2006-07-12 6:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-12 5:47 sparse annotation question Keith Owens
2006-07-12 6:14 ` David Miller
2006-07-12 6:42 ` Keith Owens [this message]
2006-07-12 7:22 ` David Miller
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=28491.1152686564@kao2.melbourne.sgi.com \
--to=kaos@ocs.com.au \
--cc=davem@davemloft.net \
--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