From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp205.alice.it ([82.57.200.101]:16901 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932153AbaFCNsy (ORCPT ); Tue, 3 Jun 2014 09:48:54 -0400 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: Antonio Ospite , Gregor Jasny Subject: [PATCH] libv4lconvert: Fix a regression when converting from Y10B Date: Tue, 3 Jun 2014 15:48:46 +0200 Message-Id: <1401803326-31942-1-git-send-email-ao2@ao2.it> Sender: linux-media-owner@vger.kernel.org List-ID: 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 Cc: Gregor Jasny --- 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