mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@gmail.com>
To: Brian Phelps <lm317t@gmail.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Gerd Knorr <kraxel@bytesex.org>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Mikael Pettersson <mikpe@it.uu.se>,
	Alexander Shaduri <ashaduri@gmail.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Julia Lawall <julia@diku.dk>
Subject: [PATCH] bttv: don't compare list_head's .next with NULL
Date: Sat, 22 Nov 2008 12:20:45 +0100	[thread overview]
Message-ID: <20081122112045.GA6890@localhost.localdomain> (raw)
In-Reply-To: <19f34abd0811211750l7edc8037ue813341779917b0@mail.gmail.com>

Hi Brian,

Can you see if this patch helps your problem?


Vegard


>From 84396b14b9059de4a697df4ea4e036a22513436e Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Sat, 22 Nov 2008 12:12:11 +0100
Subject: [PATCH] bttv: don't compare list_head's .next with NULL

The list implementation doesn't store NULLs in .next/.prev, but
uses poison values (for-sure invalid pointers). I assume that this
code wanted to test whether an entry was the last in a list.

This function is only ever called for the video capture list, so
we know which list to check (it could have been vcapture as well).

Patch is untested!

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 drivers/media/video/bt8xx/bttv-risc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
index 5b1b8e4..7a54c99 100644
--- a/drivers/media/video/bt8xx/bttv-risc.c
+++ b/drivers/media/video/bt8xx/bttv-risc.c
@@ -649,14 +649,14 @@ bttv_buffer_activate_video(struct bttv *btv,
 	if (NULL != set->top  &&  NULL != set->bottom) {
 		if (set->top == set->bottom) {
 			set->top->vb.state    = VIDEOBUF_ACTIVE;
-			if (set->top->vb.queue.next)
+			if (list_is_last(&set->top->vb.queue, &btv->capture))
 				list_del(&set->top->vb.queue);
 		} else {
 			set->top->vb.state    = VIDEOBUF_ACTIVE;
 			set->bottom->vb.state = VIDEOBUF_ACTIVE;
-			if (set->top->vb.queue.next)
+			if (list_is_last(&set->top->vb.queue, &btv->capture))
 				list_del(&set->top->vb.queue);
-			if (set->bottom->vb.queue.next)
+			if (list_is_last(&set->bottom->vb.queue, &btv->capture))
 				list_del(&set->bottom->vb.queue);
 		}
 		bttv_apply_geo(btv, &set->top->geo, 1);
@@ -671,7 +671,7 @@ bttv_buffer_activate_video(struct bttv *btv,
 		      ~0x0f, BT848_COLOR_CTL);
 	} else if (NULL != set->top) {
 		set->top->vb.state  = VIDEOBUF_ACTIVE;
-		if (set->top->vb.queue.next)
+		if (list_is_last(&set->top->vb.queue, &btv->capture))
 			list_del(&set->top->vb.queue);
 		bttv_apply_geo(btv, &set->top->geo,1);
 		bttv_apply_geo(btv, &set->top->geo,0);
@@ -682,7 +682,7 @@ bttv_buffer_activate_video(struct bttv *btv,
 		btaor(set->top->btswap & 0x0f,   ~0x0f, BT848_COLOR_CTL);
 	} else if (NULL != set->bottom) {
 		set->bottom->vb.state = VIDEOBUF_ACTIVE;
-		if (set->bottom->vb.queue.next)
+		if (list_is_last(&set->bottom->vb.queue, &btv->capture))
 			list_del(&set->bottom->vb.queue);
 		bttv_apply_geo(btv, &set->bottom->geo,1);
 		bttv_apply_geo(btv, &set->bottom->geo,0);
-- 
1.5.6.5


  reply	other threads:[~2008-11-22 11:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 23:24 kernel BUG at mm/slab.c:601 Brian Phelps
2008-11-19 13:40 ` Brian Phelps
2008-11-19 22:19 ` Vegard Nossum
2008-11-20 17:01   ` Brian Phelps
2008-11-22  1:10     ` Vegard Nossum
2008-11-22  1:25       ` Vegard Nossum
2008-11-22  1:26         ` Vegard Nossum
2008-11-22  1:50           ` Vegard Nossum
2008-11-22 11:20             ` Vegard Nossum [this message]
2008-11-24 17:13               ` [PATCH] bttv: don't compare list_head's .next with NULL Brian Phelps
2008-11-24 10:39           ` kernel BUG at mm/slab.c:601 Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081122112045.GA6890@localhost.localdomain \
    --to=vegard.nossum@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=ashaduri@gmail.com \
    --cc=julia@diku.dk \
    --cc=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm317t@gmail.com \
    --cc=mchehab@infradead.org \
    --cc=mikpe@it.uu.se \
    --cc=rjw@sisk.pl \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®