public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: suppress sparse warning in copy_to_user()
Date: Tue, 04 Oct 2016 10:49:06 +0200	[thread overview]
Message-ID: <1475570946.5324.37.camel@sipsolutions.net> (raw)
In-Reply-To: <57F385DC0200007800114C92@prv-mh.provo.novell.com>


> > > If that was the case, everyone should have seen such warnings
> > > from the day the original patch got introduced. 
> > 
> > Only if they run sparse. Clearly people don't, or we wouldn't have
> > a history of a ton of such problems, e.g.
> 
> No - you say "which gcc declares with (void *, int type) prototype".
> If that was the case, there would need to be a warning.

There would need to be a warning when?

> > > And the compiler warnings
> > > I get when testing with all four combinations of const and
> > > volatile
> > > also supports this by saying "expected 'const void *' but ..." 
> > 
> > It's not a compiler warning though that I'm getting.
> > 
> > What tool are you using to get such a warning?
> 
> I'm talking about gcc and the warning surfacing when I additonally
> add volatile.

Oh, sorry. If you get the warning, it prints "expected 'const void *'"
... yeah, I see.

> > https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html 
> 
> Perhaps it's just the documentation which is imprecise here?

Hmm, yeah, that could be right, or maybe it changed at some point?

If it were defined the way the documentation says, you should have
gotten a compiler warning ("passing argument 1 ... discards ‘const’
qualifier from pointer target type") with the code as it is (without my
patch), since you can't pass a const pointer to a function that expects
a non-const pointer. Clearly that didn't happen.

That does indicate that the prototype is indeed with the const, I guess
I'll go fix sparse instead.

Sorry I misread your earlier explanation entirely!

johannes

  reply	other threads:[~2016-10-04  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04  7:33 [PATCH] x86: suppress sparse warning in copy_to_user() Johannes Berg
2016-10-04  7:51 ` Jan Beulich
2016-10-04  8:02   ` Johannes Berg
2016-10-04  8:35     ` Jan Beulich
2016-10-04  8:49       ` Johannes Berg [this message]
2016-10-04  9:03         ` Jan Beulich

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=1475570946.5324.37.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=JBeulich@suse.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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