Subject: Re: linux-next: build warnings after merge of the akpm tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 26 Oct 2012 01:16:45 +1100

Hi Richard,

On Thu, 25 Oct 2012 22:12:32 +0800 Richard Yang <[email-masked]> 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                    [email-masked]