Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1466956
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation |
| Date | 2016-08-21 12:10 +0200 |
| Message-ID | <s8xRw-7py-37@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <s8xy9-73h-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Le 21/08/2016 à 11:45, SF Markus Elfring a écrit :
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 21 Aug 2016 11:30:57 +0200
>
> Reuse existing functionality from memdup_user() instead of keeping
> duplicate source code.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/staging/lustre/lustre/llite/dir.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
> index 031c9e4..8b70e42 100644
> --- a/drivers/staging/lustre/lustre/llite/dir.c
> +++ b/drivers/staging/lustre/lustre/llite/dir.c
> @@ -1676,14 +1676,9 @@ out_poll:
> case LL_IOC_QUOTACTL: {
> struct if_quotactl *qctl;
>
> - qctl = kzalloc(sizeof(*qctl), GFP_NOFS);
Same as previously reported in another patch, GFP_NOFS has not the same
meaning than GPF_KERNEL.
So your proposed clean-up is not 100% equivalent.
Are your sure that GPF_KERNEL instead of GFP_NOFS is right in this code?
Maybe, the coccinelle check should be tweak to only spot "kzalloc(...,
GFP_KERNEL)" allocation?
> - if (!qctl)
> - return -ENOMEM;
> -
> - if (copy_from_user(qctl, (void __user *)arg, sizeof(*qctl))) {
> - rc = -EFAULT;
> - goto out_quotactl;
> - }
> + qctl = memdup_user((void __user *)arg, sizeof(*qctl));
> + if (IS_ERR(qctl))
> + return PTR_ERR(qctl);
>
> rc = quotactl_ioctl(sbi, qctl);
>
> @@ -1691,7 +1686,6 @@ out_poll:
> sizeof(*qctl)))
> rc = -EFAULT;
>
> -out_quotactl:
> kfree(qctl);
> return rc;
> }
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-21 11:50 +0200
Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-08-21 12:10 +0200
Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation Julia Lawall <julia.lawall@lip6.fr> - 2016-08-21 12:40 +0200
Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2016-08-21 13:00 +0200
Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation Julia Lawall <julia.lawall@lip6.fr> - 2016-08-21 13:10 +0200
Re: [PATCH] staging/lustre/llite: Use memdup_user() rather than duplicating its implementation Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2016-08-21 14:20 +0200
csiph-web