linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	kbuild test robot <fengguang.wu@intel.com>,
	Jingoo Han <jg1.han@samsung.com>,
	kbuild-all@01.org, Linux-Sparse <linux-sparse@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] forced argument Was Re: sparse: incorrect type in argument 1 (different address spaces)
Date: Fri, 26 Apr 2013 09:35:38 +0300	[thread overview]
Message-ID: <20130426063538.GA5072@mwanda> (raw)
In-Reply-To: <5179E1E1.4050304@chrisli.org>

On Thu, Apr 25, 2013 at 07:09:37PM -0700, Christopher Li wrote:
> On 04/22/2013 11:16 PM, Dan Carpenter wrote:
> > That didn't work.  It's the the void * in the parameter list that's
> > the problem.  We'd need to do something like the patch below:
> > 
> > Otherwise we could add "__ok_to_cast" thing to Sparse maybe?
> 
> Thanks for the insight. I make a small patch to test the __ok_to_cast
> feature. The syntax is adding the force attribute to the argument
> declaration.
> 
> it will look like this:
> static inline long __must_check PTR_ERR( __force const void *ptr)
> 
> That means the "ptr" argument will perform a forced cast when receiving
> the argument. It is OK to pass __iomem pointer to "ptr".
> 
> The example are in the patch. It need to patch both sparse and the
> Linux tree.
> 
> What do you say?

That's looks great.  :)

I tested a patched kernel with an unpatched kernel as well and that
doesn't cause any new problems.

regards,
dan carpenter


      reply	other threads:[~2013-04-26  6:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5171d93a.0NZAGYYKNj8hjsAs%fengguang.wu@intel.com>
2013-04-22 23:56 ` [next:akpm 798/1000] drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces) Andrew Morton
2013-04-23  2:51   ` Fengguang Wu
2013-04-23  2:56   ` Christopher Li
2013-04-23  6:16     ` Dan Carpenter
2013-04-26  2:09       ` [PATCH] forced argument Was " Christopher Li
2013-04-26  6:35         ` Dan Carpenter [this message]

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=20130426063538.GA5072@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=jg1.han@samsung.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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;
as well as URLs for NNTP newsgroup(s).