From: Yuanhan Liu <yliu.null@gmail.com>
To: Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au,
linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
fengguang.wu@intel.com, yuanhan.liu@linux.intel.com
Subject: Re: [PATCH] Fix the warning related to type check in kfifo.h
Date: Fri, 26 Oct 2012 00:14:21 +0800 [thread overview]
Message-ID: <CAGZGoEejN6pxy8=w_-R2Z4hFMtimCuj-mZBeKBHHOsW4xA8u_g@mail.gmail.com> (raw)
In-Reply-To: <1351178137-10760-1-git-send-email-weiyang@linux.vnet.ibm.com>
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.
prev parent reply other threads:[~2012-10-25 16:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 15:15 [PATCH] Fix the warning related to type check in kfifo.h Wei Yang
2012-10-25 16:14 ` Yuanhan Liu [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='CAGZGoEejN6pxy8=w_-R2Z4hFMtimCuj-mZBeKBHHOsW4xA8u_g@mail.gmail.com' \
--to=yliu.null@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=weiyang@linux.vnet.ibm.com \
--cc=yuanhan.liu@linux.intel.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).