drm, video: fix use-before-NULL-check
Subsystems (3)
PATCH 1/1 drm, video: fix use-before-NULL-check
Fix potential crashes due to use-before-NULL situations.
Signed-off-by Kees Cook <[email protected]>
--- drivers/gpu/drm/drm_fb_helper.c | 3 ++- drivers/media/video/em28xx/em28xx-video.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +2 -1
@@ -94,10 +94,11 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_fb_helper_connint i;enum drm_connector_force force =DRM_FORCE_UNSPECIFIED ;struct drm_fb_helper_cmdline_mode *cmdline_mode; -struct drm_connector *connector = fb_helper_conn->connector; +struct drm_connector *connector;if (!fb_helper_conn)return false; + connector = fb_helper_conn->connector; cmdline_mode = &fb_helper_conn->cmdline_mode;if (!mode_option)
drivers/media/video/em28xx/em28xx-video.c +2 -1
@@ -277,12 +277,13 @@ static void em28xx_copy_vbi(struct em28xx *dev, {void *startwrite, *startread;int offset; -int bytesperline = dev->vbi_width; +int bytesperline;if (dev ==NULL ) {em28xx_isocdbg ("dev is null\n" );return ; } + bytesperline = dev->vbi_width;if (dma_q ==NULL ) {em28xx_isocdbg ("dma_q is null\n" );
Signature · 6 lines
1.7.1 -- Kees Cook Ubuntu Security Team
Quoted 34 lines · On Fri, 27 Aug 2010 14:07:19 -0700 Kees Cook <[email protected]> wrote:
Fix potential crashes due to use-before-NULL situations.
Signed-off-by Kees Cook <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 3 ++- drivers/media/video/em28xx/em28xx-video.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_fb_helper.c +2
-1@@ -94,10 +94,11 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_fb_helper_connint i;enum drm_connector_force force =DRM_FORCE_UNSPECIFIED ;struct drm_fb_helper_cmdline_mode *cmdline_mode; -struct drm_connector *connector = fb_helper_conn->connector; +struct drm_connector *connector;if (!fb_helper_conn)return false; + connector = fb_helper_conn->connector; cmdline_mode = &fb_helper_conn->cmdline_mode;if (!mode_option)drivers/media/video/em28xx/em28xx-video.c +0
-1@@ -277,12 +277,13 @@ static void em28xx_copy_vbi(struct em28xx *dev, {void *startwrite, *startread;int offset; -int bytesperline = dev->vbi_width;
drivers/media/video/em28xx/em28xx-video.c static void em28xx_copy_vbi(struct em28xx *dev, · line 289
Quoted 10 lines
drivers/media/video/em28xx/em28xx-video.c +2
-0+int bytesperline;if (dev ==NULL ) {em28xx_isocdbg ("dev is null\n" );return ; } + bytesperline = dev->vbi_width;if (dma_q ==NULL ) {em28xx_isocdbg ("dma_q is null\n" );
Look fine to me.
Reviewed-by Jesse Barnes <[email protected]>
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center