diff options
author | Xiubo Li <Li.Xiubo@freescale.com> | 2014-03-09 21:33:58 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-03-17 06:23:08 -0400 |
commit | 04cfe97eb11c28848d14ba8c88124da31a9f881c (patch) | |
tree | 520bfac563bb7cdcf12c1a793c26c7d20948e5c1 | |
parent | 409bbf1e3da29aaf57b520e29f904db9c7c2475e (diff) |
drm/fb-helper: Do the 'max_conn_count' zero check
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.Xiubo@freescale.com>
CC: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index e5208e072ac7..89382dce1d59 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -516,6 +516,9 @@ int drm_fb_helper_init(struct drm_device *dev, | |||
516 | struct drm_crtc *crtc; | 516 | struct drm_crtc *crtc; |
517 | int i; | 517 | int i; |
518 | 518 | ||
519 | if (!max_conn_count) | ||
520 | return -EINVAL; | ||
521 | |||
519 | fb_helper->dev = dev; | 522 | fb_helper->dev = dev; |
520 | 523 | ||
521 | INIT_LIST_HEAD(&fb_helper->kernel_fb_list); | 524 | INIT_LIST_HEAD(&fb_helper->kernel_fb_list); |