From patchwork Mon Jun 16 15:00:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 24411 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1WwYRX-0000kV-Vz; Mon, 16 Jun 2014 17:03:32 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1WwYRV-00051i-kL; Mon, 16 Jun 2014 17:03:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbaFPPD1 (ORCPT + 1 other); Mon, 16 Jun 2014 11:03:27 -0400 Received: from smtp209.alice.it ([82.57.200.105]:43680 "EHLO smtp209.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753255AbaFPPD0 (ORCPT ); Mon, 16 Jun 2014 11:03:26 -0400 Received: from jcn (79.2.146.62) by smtp209.alice.it (8.6.060.28) id 52443BB02D495F97; Mon, 16 Jun 2014 17:03:18 +0200 Received: from ao2 by jcn with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1WwYRJ-0003qc-Ov; Mon, 16 Jun 2014 17:03:17 +0200 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: Antonio Ospite , Hans de Goede , Gregor Jasny Subject: [PATCH RESEND] libv4lconvert: Fix a regression when converting from Y10B Date: Mon, 16 Jun 2014 17:00:41 +0200 Message-Id: <1402930841-14755-1-git-send-email-ao2@ao2.it> X-Mailer: git-send-email 2.0.0 In-Reply-To: <20140603155930.f72e14f4aab39ec49bdb1b71@ao2.it> References: <20140603155930.f72e14f4aab39ec49bdb1b71@ao2.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.6.16.145420 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1600_1699 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 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 --- 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: