Skip to contentSkip to conversation

video: fix potential use-before-NULL-check crash

PATCH New Kees Cook 1 participant 1 message Oct 6, 2010 Media (V4L/DVB)

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 video: fix potential use-before-NULL-check crash

Moves use to after NULL-check.

---

Sent before as part of https://patchwork.kernel.org/patch/138711/ but it still hasn't been applied.

---
 drivers/media/video/em28xx/em28xx-video.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/media/video/em28xx/em28xx-video.c +2 -1
index 7b9ec6e..95a4b60 100644
@@ -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