Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755061AbbLVP0d (ORCPT ); Tue, 22 Dec 2015 10:26:33 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59716 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754912AbbLVP0P (ORCPT ); Tue, 22 Dec 2015 10:26:15 -0500 Date: Tue, 22 Dec 2015 07:26:14 -0800 From: Greg Kroah-Hartman To: Niranjan Dighe Cc: devel@driverdev.osuosl.org, Dmitry Eremin , Andreas Dilger , Patrick Boettcher , linux-kernel@vger.kernel.org, Oleg Drokin , James Simmons , Matthew Tyler , lustre-devel@lists.lustre.org Subject: Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse Message-ID: <20151222152614.GB14779@kroah.com> References: <20151209170813.GA12216@codebox> <20151221234443.GA11245@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 58 On Tue, Dec 22, 2015 at 06:35:21PM +0530, Niranjan Dighe wrote: > On Tue, Dec 22, 2015 at 5:14 AM, Greg Kroah-Hartman > wrote: > > On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote: > >> The third argument to function kportal_memhog_alloc is expected to > >> be gfp_t whereas the actual argument was unsigned int. Fix this by > >> explicitly typecasting to gfp_t > >> > >> Signed-off-by: Niranjan Dighe > >> --- > >> drivers/staging/lustre/lustre/libcfs/module.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c > >> index 96d9d46..9c79f6e 100644 > >> --- a/drivers/staging/lustre/lustre/libcfs/module.c > >> +++ b/drivers/staging/lustre/lustre/libcfs/module.c > >> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd, > >> /* XXX The ioc_flags is not GFP flags now, need to be fixed */ > >> err = kportal_memhog_alloc(pfile->private_data, > >> data->ioc_count, > >> - data->ioc_flags); > >> + (__force gfp_t)data->ioc_flags); > > > > No, please fix the type to be correct properly, like the comment says > > needs to be done. > > > > thanks, > > > > greg k-h > > Hello Greg, > > I could see that the ioc_flags member of the struct libcfs_ioctl_data > is used as gfp_t only in the > case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to > correct it - > > 1. Create a union that has 2 different types encapsulated, something like this - > union { > __u32 ioc_flags; > gfp_t alloc_flags; > }flags; > Because, the ioc_flags seems to be used in different contexts at > different places throughout the > drivers/staging/lustre directory. This crosses the user/kernel boundry? Hah, no, just drop it, don't touch this at all, lustre ioctls are a complete mess and need to be fixed up by the authors who can test them, just leave this alone for now, sorry. greg k-h -- 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/