* [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-11 17:56 ` Markus Elfring
0 siblings, 0 replies; 14+ messages in thread
From: Markus Elfring @ 2020-08-11 17:56 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs,
Daniel Vetter, David Airlie
Cc: Julia Lawall, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, LKML,
Denis Efremov
From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Date: Tue, 11 Aug 2020 19:25:22 +0200
Reuse existing functionality from vmemdup_user() instead of keeping
duplicate source code.
Generated by: scripts/coccinelle/api/memdup_user.cocci
Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 81f111ad3f4f..7ef6221408af 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -587,15 +587,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
+ mem = vmemdup_user(userptr, size);
+ if (IS_ERR(mem))
+ return ERR_PTR(PTR_ERR(mem));
return mem;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-11 17:56 ` Markus Elfring
0 siblings, 0 replies; 14+ messages in thread
From: Markus Elfring @ 2020-08-11 17:56 UTC (permalink / raw)
To: nouveau, dri-devel, Ben Skeggs, Daniel Vetter, David Airlie
Cc: Julia Lawall, kernel-janitors, LKML, Denis Efremov
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 11 Aug 2020 19:25:22 +0200
Reuse existing functionality from vmemdup_user() instead of keeping
duplicate source code.
Generated by: scripts/coccinelle/api/memdup_user.cocci
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 81f111ad3f4f..7ef6221408af 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -587,15 +587,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
+ mem = vmemdup_user(userptr, size);
+ if (IS_ERR(mem))
+ return ERR_PTR(PTR_ERR(mem));
return mem;
}
--
2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
2020-08-11 17:56 ` Markus Elfring
(?)
(?)
@ 2020-08-13 13:12 ` kernel test robot
-1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: kbuild-all, Julia Lawall, kernel-janitors, LKML, Denis Efremov
From: kernel test robot <lkp@intel.com>
drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Generated by: scripts/coccinelle/api/err_cast.cocci
CC: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: kernel test robot <lkp@intel.com>
---
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
nouveau_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -586,7 +586,7 @@ u_memcpya(uint64_t user, unsigned nmemb,
size *= nmemb;
mem = vmemdup_user(userptr, size);
if (IS_ERR(mem))
- return ERR_PTR(PTR_ERR(mem));
+ return ERR_CAST(mem);
return mem;
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
2020-08-11 17:56 ` Markus Elfring
` (2 preceding siblings ...)
(?)
@ 2020-08-13 13:12 ` kernel test robot
-1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: kbuild-all, Julia Lawall, kernel-janitors, LKML, Denis Efremov
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
Hi Markus,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip tegra-drm/drm/tegra/for-next linus/master drm/drm-next drm-exynos/exynos-drm-next v5.8 next-20200812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34067 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: Julia Lawall, kernel-janitors, kbuild-all, LKML, Denis Efremov
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
Hi Markus,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip tegra-drm/drm/tegra/for-next linus/master drm/drm-next drm-exynos/exynos-drm-next v5.8 next-20200812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34067 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: Julia Lawall, kernel-janitors, kbuild-all, LKML, Denis Efremov
From: kernel test robot <lkp@intel.com>
drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Generated by: scripts/coccinelle/api/err_cast.cocci
CC: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: kernel test robot <lkp@intel.com>
---
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
nouveau_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -586,7 +586,7 @@ u_memcpya(uint64_t user, unsigned nmemb,
size *= nmemb;
mem = vmemdup_user(userptr, size);
if (IS_ERR(mem))
- return ERR_PTR(PTR_ERR(mem));
+ return ERR_CAST(mem);
return mem;
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs,
Daniel Vetter, David Airlie
Cc: Julia Lawall, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
kbuild-all-hn68Rpc1hR1g9hUCZPvPmw, LKML, Denis Efremov
[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]
Hi Markus,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip tegra-drm/drm/tegra/for-next linus/master drm/drm-next drm-exynos/exynos-drm-next v5.8 next-20200812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34067 bytes --]
[-- Attachment #3: Type: text/plain, Size: 182 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: Julia Lawall, kernel-janitors, kbuild-all, LKML, Denis Efremov
From: kernel test robot <lkp@intel.com>
drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Generated by: scripts/coccinelle/api/err_cast.cocci
CC: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: kernel test robot <lkp@intel.com>
---
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
nouveau_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -586,7 +586,7 @@ u_memcpya(uint64_t user, unsigned nmemb,
size *= nmemb;
mem = vmemdup_user(userptr, size);
if (IS_ERR(mem))
- return ERR_PTR(PTR_ERR(mem));
+ return ERR_CAST(mem);
return mem;
}
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: Markus Elfring, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: Julia Lawall, kernel-janitors, kbuild-all, LKML, Denis Efremov
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
Hi Markus,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip tegra-drm/drm/tegra/for-next linus/master drm/drm-next drm-exynos/exynos-drm-next v5.8 next-20200812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34067 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
From: kernel test robot <lkp@intel.com>
drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Generated by: scripts/coccinelle/api/err_cast.cocci
CC: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: kernel test robot <lkp@intel.com>
---
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
nouveau_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -586,7 +586,7 @@ u_memcpya(uint64_t user, unsigned nmemb,
size *= nmemb;
mem = vmemdup_user(userptr, size);
if (IS_ERR(mem))
- return ERR_PTR(PTR_ERR(mem));
+ return ERR_CAST(mem);
return mem;
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-13 13:12 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2020-08-13 13:12 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]
Hi Markus,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip tegra-drm/drm/tegra/for-next linus/master drm/drm-next drm-exynos/exynos-drm-next v5.8 next-20200812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-c002-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34067 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
2020-08-13 13:12 ` kernel test robot
(?)
@ 2020-08-14 7:09 ` Markus Elfring
-1 siblings, 0 replies; 14+ messages in thread
From: Markus Elfring @ 2020-08-14 7:09 UTC (permalink / raw)
To: kernel test robot, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs,
Daniel Vetter, David Airlie
Cc: kbuild-all-hn68Rpc1hR1g9hUCZPvPmw,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, LKML, Denis Efremov,
Julia Lawall, Coccinelle
From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Date: Fri, 14 Aug 2020 08:56:54 +0200
* Reuse existing functionality from vmemdup_user() instead of keeping
duplicate source code.
Generated by: scripts/coccinelle/api/memdup_user.cocci
* See also:
[PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
* Simplify this function implementation further by omitting the local
variable “mem” and extra error handling here.
Reported-by: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 81f111ad3f4f..536ad5e2cbe6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -583,21 +583,10 @@ u_free(void *addr)
static inline void *
u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
{
- void *mem;
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
-
- return mem;
+ return vmemdup_user(userptr, size);
}
static int
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Cocci] [PATCH v2] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-14 7:09 ` Markus Elfring
0 siblings, 0 replies; 14+ messages in thread
From: Markus Elfring @ 2020-08-14 7:09 UTC (permalink / raw)
To: kernel test robot, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: kbuild-all, kernel-janitors, LKML, Julia Lawall, Coccinelle
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Aug 2020 08:56:54 +0200
* Reuse existing functionality from vmemdup_user() instead of keeping
duplicate source code.
Generated by: scripts/coccinelle/api/memdup_user.cocci
* See also:
[PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
* Simplify this function implementation further by omitting the local
variable “mem” and extra error handling here.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 81f111ad3f4f..536ad5e2cbe6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -583,21 +583,10 @@ u_free(void *addr)
static inline void *
u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
{
- void *mem;
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
-
- return mem;
+ return vmemdup_user(userptr, size);
}
static int
--
2.28.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
@ 2020-08-14 7:09 ` Markus Elfring
0 siblings, 0 replies; 14+ messages in thread
From: Markus Elfring @ 2020-08-14 7:09 UTC (permalink / raw)
To: kernel test robot, nouveau, dri-devel, Ben Skeggs, Daniel Vetter,
David Airlie
Cc: kbuild-all, kernel-janitors, LKML, Denis Efremov, Julia Lawall,
Coccinelle
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Aug 2020 08:56:54 +0200
* Reuse existing functionality from vmemdup_user() instead of keeping
duplicate source code.
Generated by: scripts/coccinelle/api/memdup_user.cocci
* See also:
[PATCH] drm/nouveau/gem: fix err_cast.cocci warnings
* Simplify this function implementation further by omitting the local
variable “mem” and extra error handling here.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/nouveau/nouveau_gem.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 81f111ad3f4f..536ad5e2cbe6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -583,21 +583,10 @@ u_free(void *addr)
static inline void *
u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
{
- void *mem;
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
-
- return mem;
+ return vmemdup_user(userptr, size);
}
static int
--
2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-08-17 7:08 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 17:56 [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation Markus Elfring
2020-08-11 17:56 ` Markus Elfring
2020-08-13 13:12 ` [PATCH] drm/nouveau/gem: fix err_cast.cocci warnings kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` [PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` kernel test robot
2020-08-13 13:12 ` kernel test robot
[not found] ` <202008132104.mkULNh4R%lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2020-08-14 7:09 ` [PATCH v2] " Markus Elfring
2020-08-14 7:09 ` Markus Elfring
2020-08-14 7:09 ` [Cocci] " Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.