From patchwork Tue May 10 03:06:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helen Koike X-Patchwork-Id: 9053811 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CAF8CBF29F for ; Tue, 10 May 2016 03:06:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 182DD20145 for ; Tue, 10 May 2016 03:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 394C820142 for ; Tue, 10 May 2016 03:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752937AbcEJDGj (ORCPT ); Mon, 9 May 2016 23:06:39 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:52260 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbcEJDGi (ORCPT ); Mon, 9 May 2016 23:06:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 77A7926095E From: Helen Koike To: linux-media@vger.kernel.org, ezequiel@vanguardiasur.com.ar, hans.verkuil@cisco.com, mchehab@osg.samsung.com Cc: Helen Koike Subject: [PATCH] [media] stk1160: Check *nplanes in queue_setup Date: Tue, 10 May 2016 00:06:14 -0300 Message-Id: <1462849574-15334-1-git-send-email-helen.koike@collabora.co.uk> X-Mailer: git-send-email 1.9.1 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.0 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 If *nplanes is not zero, it should use the requested size if valid Signed-off-by: Helen Koike --- drivers/media/usb/stk1160/stk1160-v4l.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index 77131fd..7ddbc02 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -680,6 +680,9 @@ static int queue_setup(struct vb2_queue *vq, *nbuffers = clamp_t(unsigned int, *nbuffers, STK1160_MIN_VIDEO_BUFFERS, STK1160_MAX_VIDEO_BUFFERS); + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; + /* This means a packed colorformat */ *nplanes = 1;