public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fix potential use-before-NULL-check crash
@ 2010-10-06 22:05 Kees Cook
  0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2010-10-06 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-media, Mauro Carvalho Chehab, Devin Heitmueller,
	Hans Verkuil, Laurent Pinchart

Moves use to after NULL-check.

Signed-off-by: Kees Cook <kees.cook@canonical.com>
---

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(-)

diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 7b9ec6e..95a4b60 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -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");
-- 
1.7.1


-- 
Kees Cook
Ubuntu Security Team

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-06 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 22:05 [PATCH] video: fix potential use-before-NULL-check crash Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox