Skip to contentSkip to conversation

Fix signedness error in drivers/media/video/vivi.c

PATCH In review Eric Sesterhenn 3 participants 3 messages Aug 19, 2006 – Aug 21, 2006 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix signedness error in drivers/media/video/vivi.c

hi,

when checking the -Wextra signedness warnings issued by gcc 4.1 I came across this one:

drivers/media/video/vivi.c:1001: warning: comparison of unsigned expression < 0 is always false

Since videobuf_reqbufs() returns negative values on errors the current code does no real error checking since gcc removes the comparison. This patch fixes this issue by making ret a normal, signed integer.

drivers/media/video/vivi.c renamed from drivers/media/video/vivi.c.orig +2 -1
@@ -992,7 +992,8 @@ static int vidiocgmbuf (struct file *fil
 	struct vivi_fh  *fh=priv;
 	struct videobuf_queue *q=&fh->vb_vidq;
 	struct v4l2_requestbuffers req;
-	unsigned int i, ret;
+	unsigned int i;
+	int ret;
 
 	req.type   = q->type;
 	req.count  = 8;
#1 lore raw

Ar Sad, 2006-08-19 am 18:19 +0200, ysgrifennodd Eric Sesterhenn:

Quoted 6 lines

Since videobuf_reqbufs() returns negative values on errors the current code does no real error checking since gcc removes the comparison. This patch fixes this issue by making ret a normal, signed integer.

Doesn't apply to latest driver tree but the problem is still present.

Alan

#2 lore raw

Em Dom, 2006-08-20 às 19:25 +0100, Alan Cox escreveu:

Quoted 9 lines

Ar Sad, 2006-08-19 am 18:19 +0200, ysgrifennodd Eric Sesterhenn:

Quoted 6 lines

Since videobuf_reqbufs() returns negative values on errors the current code does no real error checking since gcc removes the comparison. This patch fixes this issue by making ret a normal, signed integer.

Doesn't apply to latest driver tree but the problem is still present.

Hmm... patch applied fine to v4l-dvb hg tree.

Quoted 3 lines

Alan

Cheers,
Mauro.