From patchwork Mon Aug 26 15:47:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2849674 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D4057BF546 for ; Mon, 26 Aug 2013 15:47:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD9592039F for ; Mon, 26 Aug 2013 15:47:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9F0720394 for ; Mon, 26 Aug 2013 15:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492Ab3HZPrY (ORCPT ); Mon, 26 Aug 2013 11:47:24 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:23814 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752391Ab3HZPrX (ORCPT ); Mon, 26 Aug 2013 11:47:23 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MS5009TAAIXBQ20@mailout1.samsung.com> for linux-media@vger.kernel.org; Tue, 27 Aug 2013 00:47:21 +0900 (KST) X-AuditID: cbfee61b-b7f776d0000016c8-03-521b78899798 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 97.D4.05832.9887B125; Tue, 27 Aug 2013 00:47:21 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MS5007BLAINCLD0@mmp2.samsung.com>; Tue, 27 Aug 2013 00:47:21 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: m.szyprowski@samsung.com, pawel@osciak.com, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, m.chehab@samsung.com, Sylwester Nawrocki , Kyungmin Park Subject: [PATCH] vb2: Allow queuing OUTPUT buffers with zeroed 'bytesused' Date: Mon, 26 Aug 2013 17:47:09 +0200 Message-id: <1377532029-12777-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgluLIzCtJLcpLzFFi42I5/e+xoG5nhXSQwcEjGhZLfu5isjjb9Ibd onPiEnaLng1bWS0urpO3WHvkLrvFlLc/2S0Ov2lndeDwmPJ7I6vH7I6ZrB6Pf71k8+jbsorR 4/MmuQDWKC6blNSczLLUIn27BK6Mlbd/sBQs4azYeu0CUwPjY/YuRk4OCQETiV+fLrBA2GIS F+6tZ+ti5OIQEpjOKLFx4x92CKeDSaLt3T02kCo2AUOJ3qN9jCC2iIC8xJPeG2AdzAJ3GSVO f9gINlZYwEvi37p2VhCbRUBV4vyfw2BxXgE3iWsffgPFOYDWKUjMmWQzgZF7ASPDKkbR1ILk guKk9FwjveLE3OLSvHS95PzcTYzgcHkmvYNxVYPFIUYBDkYlHt4ANukgIdbEsuLK3EOMEhzM SiK8HKlAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rwHW60DhQTSE0tSs1NTC1KLYLJMHJxSDYzL HvWZsi7fdE1zp8RT1Xuda9jyNx+bm9Np7vLpU5J+QtizU1s2OW7738e/Vv98282POrvaKz7c fBZtem+T0StxZ7GtfHsjJ3sLOjVszbr/IPw/R+LT2omHBQ/FLv68R3Lm8xPPjmkdSn8SXG0T sW7S0laOK1Ir1jBpz+g7tTm9/OzrCafsG6z/KLEUZyQaajEXFScCAMUV3G4TAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Modify the bytesused/data_offset check to not fail if both bytesused and data_offset is set to 0. This should minimize possible issues in existing applications which worked before we enforced the plane lengths for output buffers checks introduced in commit 8023ed09cb278004a2 "videobuf2-core: Verify planes lengths for output buffers" Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park Acked-by: Laurent Pinchart Acked-by: Marek Szyprowski --- drivers/media/v4l2-core/videobuf2-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 594c75e..de0e87f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -353,7 +353,9 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) if (b->m.planes[plane].bytesused > length) return -EINVAL; - if (b->m.planes[plane].data_offset >= + + if (b->m.planes[plane].data_offset > 0 && + b->m.planes[plane].data_offset >= b->m.planes[plane].bytesused) return -EINVAL; }