public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Niranjan Dighe <niranjan.dighe@gmail.com>
Cc: devel@driverdev.osuosl.org,
	Dmitry Eremin <dmitry.eremin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Patrick Boettcher <patrick.boettcher@posteo.de>,
	linux-kernel@vger.kernel.org, Oleg Drokin <oleg.drokin@intel.com>,
	James Simmons <jsimmons@infradead.org>,
	Matthew Tyler <matt.tyler@flashics.com>,
	lustre-devel@lists.lustre.org
Subject: Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
Date: Tue, 22 Dec 2015 07:26:14 -0800	[thread overview]
Message-ID: <20151222152614.GB14779@kroah.com> (raw)
In-Reply-To: <CADCM0GL7M=-Em85rMa-L0mJK-TN=-fD1PWqvWRpYJkLXicZYUA@mail.gmail.com>

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
> <gregkh@linuxfoundation.org> 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 <niranjan.dighe@gmail.com>
> >> ---
> >>  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

  reply	other threads:[~2015-12-22 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 17:08 [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse Niranjan Dighe
2015-12-21 23:44 ` Greg Kroah-Hartman
2015-12-22 13:05   ` Niranjan Dighe
2015-12-22 15:26     ` Greg Kroah-Hartman [this message]
2015-12-22 22:04     ` Dilger, Andreas
2015-12-23  6:27       ` Niranjan Dighe
2016-01-05 20:54         ` [lustre-devel] " Simmons, James A.
2016-01-05 15:43     ` Simmons, James A.

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=20151222152614.GB14779@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dmitry.eremin@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=matt.tyler@flashics.com \
    --cc=niranjan.dighe@gmail.com \
    --cc=oleg.drokin@intel.com \
    --cc=patrick.boettcher@posteo.de \
    /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