Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946321Ab2JYQO3 (ORCPT ); Thu, 25 Oct 2012 12:14:29 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:47086 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946151Ab2JYQOW (ORCPT ); Thu, 25 Oct 2012 12:14:22 -0400 MIME-Version: 1.0 In-Reply-To: <1351178137-10760-1-git-send-email-weiyang@linux.vnet.ibm.com> References: <1351178137-10760-1-git-send-email-weiyang@linux.vnet.ibm.com> Date: Fri, 26 Oct 2012 00:14:21 +0800 Message-ID: Subject: Re: [PATCH] Fix the warning related to type check in kfifo.h From: Yuanhan Liu To: Wei Yang 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 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1291 Lines: 34 Hi Yang, On Thu, Oct 25, 2012 at 11:15 PM, Wei Yang 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/