All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libv4lconvert: Fix a regression when converting from Y10B
@ 2014-06-03 13:48 Antonio Ospite
  2014-06-03 13:59 ` Antonio Ospite
  0 siblings, 1 reply; 9+ messages in thread
From: Antonio Ospite @ 2014-06-03 13:48 UTC (permalink / raw)
  To: linux-media; +Cc: Antonio Ospite, Gregor Jasny

Fix a regression introduced in commit
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 (libv4lconvert: Reject too
short source buffer before accessing it).

The old code:

case V4L2_PIX_FMT_Y10BPACK:
	...
	if (result == 0 && src_size < (width * height * 10 / 8)) {
		V4LCONVERT_ERR("short y10b data frame\n");
		errno = EPIPE;
		result = -1;
	}
	...

meant to say "If the conversion was *successful* _but_ the frame size
was invalid, then take the error path", but in
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 this (maybe weird) logic was
misunderstood and the v4lconvert_convert_pixfmt() was made to return an
error even in the case of a successful conversion from Y10B.

Fix the check, and now print only the message letting the errno and the
result from the conversion routines to be propagated to the caller.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Gregor Jasny <gjasny@googlemail.com>
---

Hi,

the regression affects only the users of the gspca-kinect driver when using
the IR stream.

I think this should be cherry-picked in stable-1.0 too.

BTW Gregor, in efc29f1764a30808ebf7b3e1d9bfa27b909bf641 you say "Reject too
short source buffer before accessing it" but the code only does "result = -1"
and then still calls the conversion routines, so it's not actually *rejecting*
the frames, am I missing anything?

Thanks,
   Antonio

 lib/libv4lconvert/libv4lconvert.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
index c49d30d..50d6906 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -1052,11 +1052,8 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
 							   width, height);
 			break;
 		}
-		if (result == 0) {
+		if (result != 0)
 			V4LCONVERT_ERR("y10b conversion failed\n");
-			errno = EPIPE;
-			result = -1;
-		}
 		break;
 
 	case V4L2_PIX_FMT_RGB565:
-- 
2.0.0


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

end of thread, other threads:[~2014-06-19  8:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03 13:48 [PATCH] libv4lconvert: Fix a regression when converting from Y10B Antonio Ospite
2014-06-03 13:59 ` Antonio Ospite
2014-06-16 15:00   ` [PATCH RESEND] " Antonio Ospite
2014-06-18 11:43     ` Hans de Goede
2014-06-18 11:46       ` Hans de Goede
2014-06-18 13:23         ` Antonio Ospite
2014-06-18 13:59           ` Hans de Goede
2014-06-18 14:40             ` Antonio Ospite
2014-06-19  8:27               ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.