staging: lustre: llite: dir: Add __user annotations
PATCH 1/1 staging: lustre: llite: dir: Add __user annotations
This patch fixes the following multiple sparse warnings by adding __user annotations:
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got char *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got int *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got void *<noident>
--- drivers/staging/lustre/lustre/llite/dir.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +19 -19
@@ -1259,7 +1259,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);/* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field.
@@ -1273,7 +1273,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (mdtidx <0 )return mdtidx; -if (put_user ((int )mdtidx, (int *)arg)) +if (put_user ((int )mdtidx, (int __user *)arg))return -EFAULT ;return 0 ;
@@ -1429,7 +1429,7 @@ lmv_out_free: tmp->lum_objects[0 ].lum_mds = mdtindex;memcpy (&tmp->lum_objects[0 ].lum_fid,ll_inode2fid (inode),sizeof (struct lu_fid )); -if (copy_to_user ((void *)arg, tmp, lum_size)) { +if (copy_to_user ((void __user *)arg, tmp, lum_size)) { rc = -EFAULT ; goto free_lmv; }
@@ -1643,7 +1643,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"mdc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;
@@ -1653,7 +1653,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"osc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;
@@ -1669,14 +1669,14 @@ out_poll:if (!qctl)return -ENOMEM ; -if (copy_from_user (qctl, (void *)arg,sizeof (*qctl))) { +if (copy_from_user (qctl, (void __user *)arg,sizeof (*qctl))) { rc = -EFAULT ; goto out_quotactl; } rc =quotactl_ioctl (sbi, qctl); -if (rc ==0 &©_to_user ((void *)arg, qctl,sizeof (*qctl))) +if (rc ==0 &©_to_user ((void __user *)arg, qctl,sizeof (*qctl))) rc = -EFAULT ; out_quotactl:
@@ -1706,7 +1706,7 @@ out_quotactl:int count, vallen;struct obd_export *exp; -if (copy_from_user (&count, (int *)arg,sizeof (int ))) +if (copy_from_user (&count, (int __user *)arg,sizeof (int )))return -EFAULT ;/* get ost count when count is zero, get mdt count otherwise */
@@ -1719,13 +1719,13 @@ out_quotactl:return rc; } -if (copy_to_user ((int *)arg, &count,sizeof (int ))) +if (copy_to_user ((int __user *)arg, &count,sizeof (int )))return -EFAULT ;return 0 ; }case LL_IOC_PATH2FID : -if (copy_to_user ((void *)arg,ll_inode2fid (inode), +if (copy_to_user ((void __user *)arg,ll_inode2fid (inode),sizeof (struct lu_fid )))return -EFAULT ;return 0 ;
@@ -1737,16 +1737,16 @@ out_quotactl:if (!capable (CFS_CAP_SYS_ADMIN ))return -EPERM ; - rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void *)arg, + rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void __user *)arg,sizeof (struct ioc_changelog ));return rc;case OBD_IOC_FID2PATH : -return ll_fid2path (inode, (void *)arg); +return ll_fid2path (inode, (void __user *)arg);case LL_IOC_HSM_REQUEST : {struct hsm_user_request *hur;ssize_t totalsize; - hur =memdup_user ((void *)arg,sizeof (*hur)); + hur =memdup_user ((void __user *)arg,sizeof (*hur));if (IS_ERR (hur))return PTR_ERR (hur);
@@ -1765,7 +1765,7 @@ out_quotactl:return -ENOMEM ;/* Copy the whole struct */ -if (copy_from_user (hur, (void *)arg, totalsize)) { +if (copy_from_user (hur, (void __user *)arg, totalsize)) {kvfree (hur);return -EFAULT ; }
@@ -1801,7 +1801,7 @@ out_quotactl:struct hsm_progress_kernel hpk;struct hsm_progress hp; -if (copy_from_user (&hp, (void *)arg,sizeof (hp))) +if (copy_from_user (&hp, (void __user *)arg,sizeof (hp)))return -EFAULT ; hpk.hpk_fid = hp.hp_fid;
@@ -1826,12 +1826,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_start (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);
@@ -1841,12 +1841,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_end (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);
Signature · 1 line
1.9.1
Quoted 2 lines · Amitoj Kaur Chawla
This patch fixes the following multiple sparse warnings by adding
__userannotations:
It's puzzling what sparse complains about. For example, there is this code:
struct lov_user_md_v1 *lumv1p = (struct lov_user_md_v1 *)arg;
...
if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1)))
return -EFAULT;
But you didn't change it, so I guess there was no complaint, even though there is no __user annotation on lumv1p.
julia
Quoted 184 lines
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got char *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got int *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got void *<noident>
Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/lustre/lustre/llite/dir.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +19
-20@@ -1259,7 +1259,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);/* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field. @@ -1273,7 +1273,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (mdtidx <0 )return mdtidx; -if (put_user ((int )mdtidx, (int *)arg)) +if (put_user ((int )mdtidx, (int __user *)arg))return -EFAULT ;return 0 ;@@ -1429,7 +1429,7 @@ lmv_out_free: tmp->lum_objects[0 ].lum_mds = mdtindex;memcpy (&tmp->lum_objects[0 ].lum_fid,ll_inode2fid (inode),sizeof (struct lu_fid )); -if (copy_to_user ((void *)arg, tmp, lum_size)) { +if (copy_to_user ((void __user *)arg, tmp, lum_size)) { rc = -EFAULT ; goto free_lmv; }@@ -1643,7 +1643,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"mdc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1653,7 +1653,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"osc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1669,14 +1669,14 @@ out_poll:if (!qctl)return -ENOMEM ; -if (copy_from_user (qctl, (void *)arg,sizeof (*qctl))) { +if (copy_from_user (qctl, (void __user *)arg,sizeof (*qctl))) { rc = -EFAULT ; goto out_quotactl; } rc =quotactl_ioctl (sbi, qctl); -if (rc ==0 &©_to_user ((void *)arg, qctl,sizeof (*qctl))) +if (rc ==0 &©_to_user ((void __user *)arg, qctl,sizeof (*qctl))) rc = -EFAULT ; out_quotactl:@@ -1706,7 +1706,7 @@ out_quotactl:int count, vallen;struct obd_export *exp; -if (copy_from_user (&count, (int *)arg,sizeof (int ))) +if (copy_from_user (&count, (int __user *)arg,sizeof (int )))return -EFAULT ;/* get ost count when count is zero, get mdt count otherwise */ @@ -1719,13 +1719,13 @@ out_quotactl:return rc; } -if (copy_to_user ((int *)arg, &count,sizeof (int ))) +if (copy_to_user ((int __user *)arg, &count,sizeof (int )))return -EFAULT ;return 0 ; }case LL_IOC_PATH2FID : -if (copy_to_user ((void *)arg,ll_inode2fid (inode), +if (copy_to_user ((void __user *)arg,ll_inode2fid (inode),sizeof (struct lu_fid )))return -EFAULT ;return 0 ;@@ -1737,16 +1737,16 @@ out_quotactl:if (!capable (CFS_CAP_SYS_ADMIN ))return -EPERM ; - rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void *)arg, + rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void __user *)arg,sizeof (struct ioc_changelog ));return rc;case OBD_IOC_FID2PATH : -return ll_fid2path (inode, (void *)arg); +return ll_fid2path (inode, (void __user *)arg);case LL_IOC_HSM_REQUEST : {struct hsm_user_request *hur;ssize_t totalsize; - hur =memdup_user ((void *)arg,sizeof (*hur)); + hur =memdup_user ((void __user *)arg,sizeof (*hur));if (IS_ERR (hur))return PTR_ERR (hur);@@ -1765,7 +1765,7 @@ out_quotactl:return -ENOMEM ;/* Copy the whole struct */ -if (copy_from_user (hur, (void *)arg, totalsize)) { +if (copy_from_user (hur, (void __user *)arg, totalsize)) {kvfree (hur);return -EFAULT ; }@@ -1801,7 +1801,7 @@ out_quotactl:struct hsm_progress_kernel hpk;struct hsm_progress hp; -if (copy_from_user (&hp, (void *)arg,sizeof (hp))) +if (copy_from_user (&hp, (void __user *)arg,sizeof (hp)))return -EFAULT ; hpk.hpk_fid = hp.hp_fid;@@ -1826,12 +1826,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_start (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);@@ -1841,12 +1841,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_end (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy); --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151030172932.GA27324%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.
Quoted 11 lines · Julia Lawall
Quoted 2 lines · Amitoj Kaur Chawla
This patch fixes the following multiple sparse warnings by adding
__userannotations:It's puzzling what sparse complains about. For example, there is this code:
struct
lov_user_md_v1*lumv1p = (structlov_user_md_v1*)arg;
...
if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1)))
Quoted 6 lines
return -EFAULT;But you didn't change it, so I guess there was no complaint, even though there is no
__userannotation on lumv1p.julia
It is complaining for this too. I tried changing it. But it gave me some other warnings when I made a similar change so I'm still trying to figure out how to stop warnings for cases like these.
I thought I could send that in as a separate patch later on with a detailed explanation for these cases *when* I figure it out and send the current changes as is.
Should I have done differently?
Quoted 185 lines
Quoted 185 lines
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got char *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got int *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got void *<noident>
Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/lustre/lustre/llite/dir.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +19
-20@@ -1259,7 +1259,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);/* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field. @@ -1273,7 +1273,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (mdtidx <0 )return mdtidx; -if (put_user ((int )mdtidx, (int *)arg)) +if (put_user ((int )mdtidx, (int __user *)arg))return -EFAULT ;return 0 ;@@ -1429,7 +1429,7 @@ lmv_out_free: tmp->lum_objects[0 ].lum_mds = mdtindex;memcpy (&tmp->lum_objects[0 ].lum_fid,ll_inode2fid (inode),sizeof (struct lu_fid )); -if (copy_to_user ((void *)arg, tmp, lum_size)) { +if (copy_to_user ((void __user *)arg, tmp, lum_size)) { rc = -EFAULT ; goto free_lmv; }@@ -1643,7 +1643,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"mdc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1653,7 +1653,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"osc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1669,14 +1669,14 @@ out_poll:if (!qctl)return -ENOMEM ; -if (copy_from_user (qctl, (void *)arg,sizeof (*qctl))) { +if (copy_from_user (qctl, (void __user *)arg,sizeof (*qctl))) { rc = -EFAULT ; goto out_quotactl; } rc =quotactl_ioctl (sbi, qctl); -if (rc ==0 &©_to_user ((void *)arg, qctl,sizeof (*qctl))) +if (rc ==0 &©_to_user ((void __user *)arg, qctl,sizeof (*qctl))) rc = -EFAULT ; out_quotactl:@@ -1706,7 +1706,7 @@ out_quotactl:int count, vallen;struct obd_export *exp; -if (copy_from_user (&count, (int *)arg,sizeof (int ))) +if (copy_from_user (&count, (int __user *)arg,sizeof (int )))return -EFAULT ;/* get ost count when count is zero, get mdt count otherwise */ @@ -1719,13 +1719,13 @@ out_quotactl:return rc; } -if (copy_to_user ((int *)arg, &count,sizeof (int ))) +if (copy_to_user ((int __user *)arg, &count,sizeof (int )))return -EFAULT ;return 0 ; }case LL_IOC_PATH2FID : -if (copy_to_user ((void *)arg,ll_inode2fid (inode), +if (copy_to_user ((void __user *)arg,ll_inode2fid (inode),sizeof (struct lu_fid )))return -EFAULT ;return 0 ;@@ -1737,16 +1737,16 @@ out_quotactl:if (!capable (CFS_CAP_SYS_ADMIN ))return -EPERM ; - rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void *)arg, + rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void __user *)arg,sizeof (struct ioc_changelog ));return rc;case OBD_IOC_FID2PATH : -return ll_fid2path (inode, (void *)arg); +return ll_fid2path (inode, (void __user *)arg);case LL_IOC_HSM_REQUEST : {struct hsm_user_request *hur;ssize_t totalsize; - hur =memdup_user ((void *)arg,sizeof (*hur)); + hur =memdup_user ((void __user *)arg,sizeof (*hur));if (IS_ERR (hur))return PTR_ERR (hur);@@ -1765,7 +1765,7 @@ out_quotactl:return -ENOMEM ;/* Copy the whole struct */ -if (copy_from_user (hur, (void *)arg, totalsize)) { +if (copy_from_user (hur, (void __user *)arg, totalsize)) {kvfree (hur);return -EFAULT ; }@@ -1801,7 +1801,7 @@ out_quotactl:struct hsm_progress_kernel hpk;struct hsm_progress hp; -if (copy_from_user (&hp, (void *)arg,sizeof (hp))) +if (copy_from_user (&hp, (void __user *)arg,sizeof (hp)))return -EFAULT ; hpk.hpk_fid = hp.hp_fid;@@ -1826,12 +1826,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_start (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);@@ -1841,12 +1841,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_end (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy); --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151030172932.GA27324%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.
Signature · 1 line
Amitoj
Quoted 23 lines · Amitoj Kaur Chawla
Quoted 11 lines · Julia Lawall
Quoted 2 lines · Amitoj Kaur Chawla
This patch fixes the following multiple sparse warnings by adding
__userannotations:It's puzzling what sparse complains about. For example, there is this code:
struct
lov_user_md_v1*lumv1p = (structlov_user_md_v1*)arg;
...
if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1)))Quoted 6 lines
return -EFAULT;But you didn't change it, so I guess there was no complaint, even though there is no
__userannotation on lumv1p.julia
It is complaining for this too. I tried changing it. But it gave me some other warnings when I made a similar change so I'm still trying to figure out how to stop warnings for cases like these.
Quoted 5 lines
I thought I could send that in as a separate patch later on with a detailed explanation for these cases *when* I figure it out and send the current changes as is.
Should I have done differently?
Maybe it would have been good to put a comment under the --- explaining that you were solving part of the problem, but hoped to do the rest later.
I was worried that a problem was getting swept under the rug, and by doing the easy cases, you were removing the motivation for people to look at the more complex cases, but if sparse continues to complain about the other cases after your patch, then maybe it's OK.
julia
Quoted 199 lines
Quoted 179 lines
Quoted 179 lines
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got char *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got int *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got void *<noident>
Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/lustre/lustre/llite/dir.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +19
-20@@ -1259,7 +1259,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);/* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field. @@ -1273,7 +1273,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (mdtidx <0 )return mdtidx; -if (put_user ((int )mdtidx, (int *)arg)) +if (put_user ((int )mdtidx, (int __user *)arg))return -EFAULT ;return 0 ;@@ -1429,7 +1429,7 @@ lmv_out_free: tmp->lum_objects[0 ].lum_mds = mdtindex;memcpy (&tmp->lum_objects[0 ].lum_fid,ll_inode2fid (inode),sizeof (struct lu_fid )); -if (copy_to_user ((void *)arg, tmp, lum_size)) { +if (copy_to_user ((void __user *)arg, tmp, lum_size)) { rc = -EFAULT ; goto free_lmv; }@@ -1643,7 +1643,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"mdc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1653,7 +1653,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"osc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1669,14 +1669,14 @@ out_poll:if (!qctl)return -ENOMEM ; -if (copy_from_user (qctl, (void *)arg,sizeof (*qctl))) { +if (copy_from_user (qctl, (void __user *)arg,sizeof (*qctl))) { rc = -EFAULT ; goto out_quotactl; } rc =quotactl_ioctl (sbi, qctl); -if (rc ==0 &©_to_user ((void *)arg, qctl,sizeof (*qctl))) +if (rc ==0 &©_to_user ((void __user *)arg, qctl,sizeof (*qctl))) rc = -EFAULT ; out_quotactl:@@ -1706,7 +1706,7 @@ out_quotactl:int count, vallen;struct obd_export *exp; -if (copy_from_user (&count, (int *)arg,sizeof (int ))) +if (copy_from_user (&count, (int __user *)arg,sizeof (int )))return -EFAULT ;/* get ost count when count is zero, get mdt count otherwise */ @@ -1719,13 +1719,13 @@ out_quotactl:return rc; } -if (copy_to_user ((int *)arg, &count,sizeof (int ))) +if (copy_to_user ((int __user *)arg, &count,sizeof (int )))return -EFAULT ;return 0 ; }case LL_IOC_PATH2FID : -if (copy_to_user ((void *)arg,ll_inode2fid (inode), +if (copy_to_user ((void __user *)arg,ll_inode2fid (inode),sizeof (struct lu_fid )))return -EFAULT ;return 0 ;@@ -1737,16 +1737,16 @@ out_quotactl:if (!capable (CFS_CAP_SYS_ADMIN ))return -EPERM ; - rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void *)arg, + rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void __user *)arg,sizeof (struct ioc_changelog ));return rc;case OBD_IOC_FID2PATH : -return ll_fid2path (inode, (void *)arg); +return ll_fid2path (inode, (void __user *)arg);case LL_IOC_HSM_REQUEST : {struct hsm_user_request *hur;ssize_t totalsize; - hur =memdup_user ((void *)arg,sizeof (*hur)); + hur =memdup_user ((void __user *)arg,sizeof (*hur));if (IS_ERR (hur))return PTR_ERR (hur);@@ -1765,7 +1765,7 @@ out_quotactl:return -ENOMEM ;/* Copy the whole struct */ -if (copy_from_user (hur, (void *)arg, totalsize)) { +if (copy_from_user (hur, (void __user *)arg, totalsize)) {kvfree (hur);return -EFAULT ; }@@ -1801,7 +1801,7 @@ out_quotactl:struct hsm_progress_kernel hpk;struct hsm_progress hp; -if (copy_from_user (&hp, (void *)arg,sizeof (hp))) +if (copy_from_user (&hp, (void __user *)arg,sizeof (hp)))return -EFAULT ; hpk.hpk_fid = hp.hp_fid;@@ -1826,12 +1826,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_start (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);@@ -1841,12 +1841,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_end (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy); --1.9.1
Quoted 7 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151030172932.GA27324%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.--
Amitoj--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CA%2B5yK5HzVQj9%3Dc20DaW-s24MjyS2N8zi3kAogTX1bHDVS870Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 34 lines · Julia Lawall
Quoted 23 lines · Amitoj Kaur Chawla
Quoted 11 lines · Julia Lawall
Quoted 2 lines · Amitoj Kaur Chawla
This patch fixes the following multiple sparse warnings by adding
__userannotations:It's puzzling what sparse complains about. For example, there is this code:
struct
lov_user_md_v1*lumv1p = (structlov_user_md_v1*)arg;
...
if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1)))Quoted 6 lines
return -EFAULT;But you didn't change it, so I guess there was no complaint, even though there is no
__userannotation on lumv1p.julia
It is complaining for this too. I tried changing it. But it gave me some other warnings when I made a similar change so I'm still trying to figure out how to stop warnings for cases like these.
Quoted 5 lines
I thought I could send that in as a separate patch later on with a detailed explanation for these cases *when* I figure it out and send the current changes as is.
Should I have done differently?
Maybe it would have been good to put a comment under the --- explaining that you were solving part of the problem, but hoped to do the rest later.
Quoted 7 lines
I was worried that a problem was getting swept under the rug, and by doing the easy cases, you were removing the motivation for people to look at the more complex cases, but if sparse continues to complain about the other cases after your patch, then maybe it's OK.
julia
If you prefer, I can send a v2 mentioning that I've solved part of the problem.
Quoted 199 lines
Quoted 199 lines
Quoted 179 lines
Quoted 179 lines
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got char *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got int *<noident>
warning: incorrect type in argument 1 (different address spaces) expected void [noderef] <asn:1>*to got void *<noident>
Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/lustre/lustre/llite/dir.c | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +19
-20@@ -1259,7 +1259,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);/* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field. @@ -1273,7 +1273,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (mdtidx <0 )return mdtidx; -if (put_user ((int )mdtidx, (int *)arg)) +if (put_user ((int )mdtidx, (int __user *)arg))return -EFAULT ;return 0 ;@@ -1429,7 +1429,7 @@ lmv_out_free: tmp->lum_objects[0 ].lum_mds = mdtindex;memcpy (&tmp->lum_objects[0 ].lum_fid,ll_inode2fid (inode),sizeof (struct lu_fid )); -if (copy_to_user ((void *)arg, tmp, lum_size)) { +if (copy_to_user ((void __user *)arg, tmp, lum_size)) { rc = -EFAULT ; goto free_lmv; }@@ -1643,7 +1643,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"mdc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1653,7 +1653,7 @@ free_lmm: NULL);if (rc) {CDEBUG (D_QUOTA ,"osc ioctl %d failed: %d\n" , cmd, rc); -if (copy_to_user ((void *)arg, check, +if (copy_to_user ((void __user *)arg, check,sizeof (*check)))CDEBUG (D_QUOTA ,"copy_to_user failed\n" ); goto out_poll;@@ -1669,14 +1669,14 @@ out_poll:if (!qctl)return -ENOMEM ; -if (copy_from_user (qctl, (void *)arg,sizeof (*qctl))) { +if (copy_from_user (qctl, (void __user *)arg,sizeof (*qctl))) { rc = -EFAULT ; goto out_quotactl; } rc =quotactl_ioctl (sbi, qctl); -if (rc ==0 &©_to_user ((void *)arg, qctl,sizeof (*qctl))) +if (rc ==0 &©_to_user ((void __user *)arg, qctl,sizeof (*qctl))) rc = -EFAULT ; out_quotactl:@@ -1706,7 +1706,7 @@ out_quotactl:int count, vallen;struct obd_export *exp; -if (copy_from_user (&count, (int *)arg,sizeof (int ))) +if (copy_from_user (&count, (int __user *)arg,sizeof (int )))return -EFAULT ;/* get ost count when count is zero, get mdt count otherwise */ @@ -1719,13 +1719,13 @@ out_quotactl:return rc; } -if (copy_to_user ((int *)arg, &count,sizeof (int ))) +if (copy_to_user ((int __user *)arg, &count,sizeof (int )))return -EFAULT ;return 0 ; }case LL_IOC_PATH2FID : -if (copy_to_user ((void *)arg,ll_inode2fid (inode), +if (copy_to_user ((void __user *)arg,ll_inode2fid (inode),sizeof (struct lu_fid )))return -EFAULT ;return 0 ;@@ -1737,16 +1737,16 @@ out_quotactl:if (!capable (CFS_CAP_SYS_ADMIN ))return -EPERM ; - rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void *)arg, + rc =copy_and_ioctl (cmd, sbi->ll_md_exp, (void __user *)arg,sizeof (struct ioc_changelog ));return rc;case OBD_IOC_FID2PATH : -return ll_fid2path (inode, (void *)arg); +return ll_fid2path (inode, (void __user *)arg);case LL_IOC_HSM_REQUEST : {struct hsm_user_request *hur;ssize_t totalsize; - hur =memdup_user ((void *)arg,sizeof (*hur)); + hur =memdup_user ((void __user *)arg,sizeof (*hur));if (IS_ERR (hur))return PTR_ERR (hur);@@ -1765,7 +1765,7 @@ out_quotactl:return -ENOMEM ;/* Copy the whole struct */ -if (copy_from_user (hur, (void *)arg, totalsize)) { +if (copy_from_user (hur, (void __user *)arg, totalsize)) {kvfree (hur);return -EFAULT ; }@@ -1801,7 +1801,7 @@ out_quotactl:struct hsm_progress_kernel hpk;struct hsm_progress hp; -if (copy_from_user (&hp, (void *)arg,sizeof (hp))) +if (copy_from_user (&hp, (void __user *)arg,sizeof (hp)))return -EFAULT ; hpk.hpk_fid = hp.hp_fid;@@ -1826,12 +1826,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_start (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy);@@ -1841,12 +1841,12 @@ out_quotactl:struct hsm_copy *copy;int rc; - copy =memdup_user ((char *)arg,sizeof (*copy)); + copy =memdup_user ((char __user *)arg,sizeof (*copy));if (IS_ERR (copy))return PTR_ERR (copy); rc =ll_ioc_copy_end (inode->i_sb, copy); -if (copy_to_user ((char *)arg, copy,sizeof (*copy))) +if (copy_to_user ((char __user *)arg, copy,sizeof (*copy))) rc = -EFAULT ;kfree (copy); --1.9.1
Quoted 7 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151030172932.GA27324%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.--
Amitoj--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CA%2B5yK5HzVQj9%3Dc20DaW-s24MjyS2N8zi3kAogTX1bHDVS870Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Signature · 1 line
Amitoj
Quoted 8 lines
Quoted 8 lines
Maybe it would have been good to put a comment under the --- explaining that you were solving part of the problem, but hoped to do the rest later.
I was worried that a problem was getting swept under the rug, and by doing the easy cases, you were removing the motivation for people to look at the more complex cases, but if sparse continues to complain about the other cases after your patch, then maybe it's OK.
Quoted 4 lines
Quoted 2 lines
julia
If you prefer, I can send a v2 mentioning that I've solved part of the problem.
Even though it doesn't have any impat on the final patch, it could be a good idea anyway.
julia
Quoted 11 lines · Julia Lawall
Quoted 11 lines
Quoted 10 lines
Maybe it would have been good to put a comment under the --- explaining that you were solving part of the problem, but hoped to do the rest later.
I was worried that a problem was getting swept under the rug, and by doing the easy cases, you were removing the motivation for people to look at the more complex cases, but if sparse continues to complain about the other cases after your patch, then maybe it's OK.
julia
Quoted 6 lines
Quoted 1 line
If you prefer, I can send a v2 mentioning that I've solved part of the problem.
Even though it doesn't have any impat on the final patch, it could be a good idea anyway.
julia
Okay. Sending v2.
Signature · 1 line
Amitoj