From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753042AbbFKJLr (ORCPT ); Thu, 11 Jun 2015 05:11:47 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:40062 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064AbbFKJLl (ORCPT ); Thu, 11 Jun 2015 05:11:41 -0400 Date: Thu, 11 Jun 2015 12:11:20 +0300 From: Dan Carpenter To: Tolga Ceylan Cc: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Julia Lawall , Greg Donald , aybuke ozdemir , Al Viro , Tina Johnson , Joe Perches , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] staging: lustre/lustre/llite: get rid of incorrect type warning Message-ID: <20150611091120.GH28762@mwanda> References: <1433804517-7709-1-git-send-email-tolga.ceylan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433804517-7709-1-git-send-email-tolga.ceylan@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 08, 2015 at 04:01:57PM -0700, Tolga Ceylan wrote: > In dir.c and llite_lib.c, sparse reports multiple warnings messages > due to different address spaces. This patch resolves these warnings > by adding the tag __user for username addresses. > > Signed-off-by: Tolga Ceylan > --- > drivers/staging/lustre/lustre/llite/dir.c | 78 +++++++++++++------------ > drivers/staging/lustre/lustre/llite/llite_lib.c | 8 +-- > 2 files changed, 45 insertions(+), 41 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c > index 4b0de8d..0441c20 100644 > --- a/drivers/staging/lustre/lustre/llite/dir.c > +++ b/drivers/staging/lustre/lustre/llite/dir.c > @@ -1258,7 +1258,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > return ll_iocontrol(inode, file, cmd, arg); > case FSFILT_IOC_GETVERSION_OLD: > case FSFILT_IOC_GETVERSION: > - return put_user(inode->i_generation, (int *)arg); > + return put_user(inode->i_generation, (int __user *)arg); I have looked at this briefly and I think the correct fix is to make ll_dir_ioctl() take a void __user *arg instead of an unsigned long arg. Of course, doing that will introduce more sparse warnings, but those are correct warnings and we should be warned about them. Maybe start at the lower level functions like obd_ioctl_getdata() and obd_ioctl_popdata() and add annotations then work up to the big functions like ll_dir_ioctl(). We shouldn't be introducing these little casts throughout. regards, dan carpenter