lkml.org 
[lkml]   [2012]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] Fix the warning related to type check in kfifo.h
From
Hi Yang,

On Thu, Oct 25, 2012 at 11:15 PM, Wei Yang <weiyang@linux.vnet.ibm.com> wrote:
> In d096f3b046, typecheck() replace the original code to check the type
> mismatch for kfifo related macros.
>
> After this patch, there shows several warnings.

Yes, we found those warnings with 0-DAY system. I checked this issue a
little and found the root cause as you stated below.

But, I have one question: why we need do the type check? The prototype
of __kfifo_type is:
unsigned int __kfifo_out(struct __kfifo *fifo, void *buf, unsigned int len).

As you see, buf is defined as void * type. And I followed that
function a bit and found it uses memcpy() to do the real _out_ things.
So, why we need do check here? memcpy can handle it no matter what
point type it is.

And please feel free to correct me if I'm wrong.

Thanks,
Yuanhan Liu

> This reason is the original
> code use the assignment to check the type. When the left value is a type of
> "void *", then there is no warning. This type of mismatch can be detected by
> typecheck() macro.


\
 
 \ /
  Last update: 2012-10-25 19:01    [W:0.048 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site