V4L: au0828: move dereference below sanity checks
Subsystems (2)
PATCH 1/1 V4L: au0828: move dereference below sanity checks
This function has sanity checks to make sure that "dev" is non-null. I moved the dereference down below the checks. In the current code "dev" is never actually null.
Signed-off-by Dan Carpenter <[email protected]>
drivers/media/video/au0828/au0828-video.c +3 -1
@@ -441,7 +441,7 @@ static void au0828_copy_vbi(struct au0828_dev *dev, unsigned char *outp, unsigned long len) {unsigned char *startwrite, *startread; -int bytesperline = dev->vbi_width; +int bytesperline;int i, j =0 ;if (dev =NULL ) {
@@ -464,6 +464,8 @@ static void au0828_copy_vbi(struct au0828_dev *dev,return ; } + bytesperline = dev->vbi_width; +if (dma_q->pos + len > buf->vb.size) len = buf->vb.size - dma_q->pos;
Quoted 21 lines · Dan Carpenter
This function has sanity checks to make sure that "dev" is non-null. I moved the dereference down below the checks. In the current code "dev" is never actually null.
Signed-off-by Dan Carpenter <[email protected]>drivers/media/video/au0828/au0828-video.c +1
-1@@ -441,7 +441,7 @@ static void au0828_copy_vbi(struct au0828_dev *dev, unsigned char *outp, unsigned long len) { unsigned char *startwrite, *startread; - int bytesperline = dev->vbi_width; + int bytesperline; int i, j = 0; if (dev = NULL) {
drivers/media/video/au0828/au0828-video.c static void au0828_copy_vbi(struct au0828_dev *dev, · line 471
Quoted 8 lines
drivers/media/video/au0828/au0828-video.c +2
-0@@ -464,6 +464,8 @@ static void au0828_copy_vbi(struct au0828_dev *dev, return; } + bytesperline = dev->vbi_width; + if (dma_q->pos + len > buf->vb.size) len = buf->vb.size - dma_q->pos;
In reality the check for "dev" can be removed since it will *never* happen (I added it during some debugging, as can be seen by the rest of the NULL checks).
Either way though, this patch is fine.
Signature · 6 lines
Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html