[PATCH] drm: avoid passing null pointer to memset

2012-10-10 Thread Chris Wilson
On Tue, 9 Oct 2012 16:56:58 -0300, Rodrigo Vivi wrote: > When cmd isn't IOC_IN | IOC_OUT a null "kdata" goes to "memset", which > dereferences it. > > v2: simpler version just using usize = 0 instead of allocating useless memory > > Signed-off-by: Rodrigo Vivi Presuming that coverity is

Re: [PATCH] drm: avoid passing null pointer to memset

2012-10-10 Thread Chris Wilson
On Tue, 9 Oct 2012 16:56:58 -0300, Rodrigo Vivi rodrigo.v...@gmail.com wrote: When cmd isn't IOC_IN | IOC_OUT a null kdata goes to memset, which dereferences it. v2: simpler version just using usize = 0 instead of allocating useless memory Signed-off-by: Rodrigo Vivi

[PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Chris Wilson
On Tue, 9 Oct 2012 14:50:46 -0300, Rodrigo Vivi wrote: > When cmd isn't IOC_IN | IOC_OUT a null "kdata" goes to "memset", which > dereferences it. > usize should be 0 in that case, since the ioctl is neither copying data in or out, for example I915_GEM_THROTTLE. To be on the safe side: if

[PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Rodrigo Vivi
When cmd isn't IOC_IN | IOC_OUT a null "kdata" goes to "memset", which dereferences it. v2: simpler version just using usize = 0 instead of allocating useless memory Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/drm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Rodrigo Vivi
When cmd isn't IOC_IN | IOC_OUT a null "kdata" goes to "memset", which dereferences it. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/drm_drv.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index

[PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Rodrigo Vivi
When cmd isn't IOC_IN | IOC_OUT a null kdata goes to memset, which dereferences it. Signed-off-by: Rodrigo Vivi rodrigo.v...@gmail.com --- drivers/gpu/drm/drm_drv.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c

Re: [PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Chris Wilson
On Tue, 9 Oct 2012 14:50:46 -0300, Rodrigo Vivi rodrigo.v...@gmail.com wrote: When cmd isn't IOC_IN | IOC_OUT a null kdata goes to memset, which dereferences it. usize should be 0 in that case, since the ioctl is neither copying data in or out, for example I915_GEM_THROTTLE. To be on the

[PATCH] drm: avoid passing null pointer to memset

2012-10-09 Thread Rodrigo Vivi
When cmd isn't IOC_IN | IOC_OUT a null kdata goes to memset, which dereferences it. v2: simpler version just using usize = 0 instead of allocating useless memory Signed-off-by: Rodrigo Vivi rodrigo.v...@gmail.com --- drivers/gpu/drm/drm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1