linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Richard Yang <weiyang@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: linux-next: build warnings after merge of the akpm tree
Date: Fri, 26 Oct 2012 01:16:45 +1100	[thread overview]
Message-ID: <20121026011645.5a4e6adac51cf0bdc44e48bc@canb.auug.org.au> (raw)
In-Reply-To: <20121025141232.GB4730@richard.(null)>

[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

Hi Richard,

On Thu, 25 Oct 2012 22:12:32 +0800 Richard Yang <weiyang@linux.vnet.ibm.com> wrote:
>
> I did a quick check. 
> 
> The root reason is, 
> 1. kfifo_in() second parameter should be type "const void *"
> 2. kfifo_out_locked() second parameter should be type "void *"
> 3. kfifo_in_locked() second parameter should be type "const void *"
> 
> And I am curious about why the original code couldn't detect this type
> mismatch.  
> 
> The reason is: the original code use = not ==. 
> so when a const void * is assigned another pointer type, there is no warning.
> 
> While I write this test code, there is still no warning. 
> int   main()
> {
> 	int *a; 
> 	void* b;
> 	b = a;  // this should be ok.
> 	a = b;  // this should need the type transfer, but still no warning.
> 	return 0;
> } 
> 
> Hmm... not understand. Any error in my test code?

Yes, any pointer can be assigned to a void pointer and a void pointer can
be assigned to any pointer, so neither of the above should complain.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-10-25 14:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  3:28 linux-next: build warnings after merge of the akpm tree Stephen Rothwell
2012-10-25  3:30 ` Stephen Rothwell
     [not found]   ` <20121025141232.GB4730@richard.(null)>
2012-10-25 14:16     ` Stephen Rothwell [this message]
     [not found]   ` <508948de.01dc440a.58ed.ffffff17SMTPIN_ADDED@mx.google.com>
2012-10-25 22:23     ` Andrew Morton
2012-10-25 23:50       ` Stephen Rothwell
     [not found]       ` <20121025223656.GA3805@richard.(null)>
2012-10-26  5:44         ` Stefani Seibold
     [not found] ` <20121025130952.GA4730@richard.(null)>
2012-10-25 14:20   ` Stephen Rothwell
2012-11-29  6:19 Stephen Rothwell
2012-11-29  7:24 ` Lars Ellenberg
2016-11-24  5:20 Stephen Rothwell

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=20121026011645.5a4e6adac51cf0bdc44e48bc@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=weiyang@linux.vnet.ibm.com \
    /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).