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: 4359801 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 48E279F26E for ; Mon, 16 Jun 2014 15:03:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6630720176 for ; Mon, 16 Jun 2014 15:03:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08FFA20138 for ; Mon, 16 Jun 2014 15:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbaFPPD1 (ORCPT ); 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-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: