public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Fix signedness error in drivers/media/video/vivi.c
@ 2006-08-19 16:19 Eric Sesterhenn
  2006-08-20 18:25 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sesterhenn @ 2006-08-19 16:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: mchehab

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.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.18-rc4/drivers/media/video/vivi.c.orig	2006-08-19 18:13:45.000000000 +0200
+++ linux-2.6.18-rc4/drivers/media/video/vivi.c	2006-08-19 18:14:16.000000000 +0200
@@ -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;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Fix signedness error in drivers/media/video/vivi.c
  2006-08-19 16:19 [Patch] Fix signedness error in drivers/media/video/vivi.c Eric Sesterhenn
@ 2006-08-20 18:25 ` Alan Cox
  2006-08-21 15:10   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2006-08-20 18:25 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel, mchehab

Ar Sad, 2006-08-19 am 18:19 +0200, ysgrifennodd Eric Sesterhenn:
> 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.
> 
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
> 

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

Alan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Fix signedness error in drivers/media/video/vivi.c
  2006-08-20 18:25 ` Alan Cox
@ 2006-08-21 15:10   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2006-08-21 15:10 UTC (permalink / raw)
  To: Alan Cox; +Cc: Eric Sesterhenn, linux-kernel

Em Dom, 2006-08-20 às 19:25 +0100, Alan Cox escreveu:
> Ar Sad, 2006-08-19 am 18:19 +0200, ysgrifennodd Eric Sesterhenn:
> > 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.
> > 
> > Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
> > 
> 
> Doesn't apply to latest driver tree but the problem is still present.
Hmm... patch applied fine to v4l-dvb hg tree. 
> 
> Alan
> 
Cheers, 
Mauro.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-21 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-19 16:19 [Patch] Fix signedness error in drivers/media/video/vivi.c Eric Sesterhenn
2006-08-20 18:25 ` Alan Cox
2006-08-21 15:10   ` Mauro Carvalho Chehab

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