Re: [PATCH v2] drm/fb-helper: Do the 'max_conn_count' zero check

2014-03-11 Thread Daniel Vetter
On Mon, Mar 10, 2014 at 09:33:58AM +0800, Xiubo Li wrote:
> Since we cannot make sure the 'max_conn_count' will always be none
> zero from the users, and then if max_conn_count equals to zero, the
> kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).
> 
> So this patch fix this with just doing the 'max_conn_count' zero check
> in the front of drm_fb_helper_init().
> 
> Signed-off-by: Xiubo Li 
> CC: Jani Nikula 

Makes sense.

Reviewed-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 3d13ca6e2..a0d286c 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -514,6 +514,9 @@ int drm_fb_helper_init(struct drm_device *dev,
>   struct drm_crtc *crtc;
>   int i;
>  
> + if (!max_conn_count)
> + return -EINVAL;
> +
>   fb_helper->dev = dev;
>  
>   INIT_LIST_HEAD(_helper->kernel_fb_list);
> -- 
> 1.8.4
> 
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] drm/fb-helper: Do the 'max_conn_count' zero check

2014-03-11 Thread Daniel Vetter
On Mon, Mar 10, 2014 at 09:33:58AM +0800, Xiubo Li wrote:
 Since we cannot make sure the 'max_conn_count' will always be none
 zero from the users, and then if max_conn_count equals to zero, the
 kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).
 
 So this patch fix this with just doing the 'max_conn_count' zero check
 in the front of drm_fb_helper_init().
 
 Signed-off-by: Xiubo Li li.xi...@freescale.com
 CC: Jani Nikula jani.nik...@linux.intel.com

Makes sense.

Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch
 ---
  drivers/gpu/drm/drm_fb_helper.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
 index 3d13ca6e2..a0d286c 100644
 --- a/drivers/gpu/drm/drm_fb_helper.c
 +++ b/drivers/gpu/drm/drm_fb_helper.c
 @@ -514,6 +514,9 @@ int drm_fb_helper_init(struct drm_device *dev,
   struct drm_crtc *crtc;
   int i;
  
 + if (!max_conn_count)
 + return -EINVAL;
 +
   fb_helper-dev = dev;
  
   INIT_LIST_HEAD(fb_helper-kernel_fb_list);
 -- 
 1.8.4
 
 
 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] drm/fb-helper: Do the 'max_conn_count' zero check

2014-03-09 Thread Xiubo Li
Since we cannot make sure the 'max_conn_count' will always be none
zero from the users, and then if max_conn_count equals to zero, the
kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).

So this patch fix this with just doing the 'max_conn_count' zero check
in the front of drm_fb_helper_init().

Signed-off-by: Xiubo Li 
CC: Jani Nikula 
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 3d13ca6e2..a0d286c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -514,6 +514,9 @@ int drm_fb_helper_init(struct drm_device *dev,
struct drm_crtc *crtc;
int i;
 
+   if (!max_conn_count)
+   return -EINVAL;
+
fb_helper->dev = dev;
 
INIT_LIST_HEAD(_helper->kernel_fb_list);
-- 
1.8.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] drm/fb-helper: Do the 'max_conn_count' zero check

2014-03-09 Thread Xiubo Li
Since we cannot make sure the 'max_conn_count' will always be none
zero from the users, and then if max_conn_count equals to zero, the
kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).

So this patch fix this with just doing the 'max_conn_count' zero check
in the front of drm_fb_helper_init().

Signed-off-by: Xiubo Li li.xi...@freescale.com
CC: Jani Nikula jani.nik...@linux.intel.com
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 3d13ca6e2..a0d286c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -514,6 +514,9 @@ int drm_fb_helper_init(struct drm_device *dev,
struct drm_crtc *crtc;
int i;
 
+   if (!max_conn_count)
+   return -EINVAL;
+
fb_helper-dev = dev;
 
INIT_LIST_HEAD(fb_helper-kernel_fb_list);
-- 
1.8.4


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/