From patchwork Tue Jan 26 21:37:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TsODwqltZXRoIE3Dg8KhcnRvbg==?= X-Patchwork-Id: 75240 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0QLc6up004500 for ; Tue, 26 Jan 2010 21:38:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342Ab0AZViE (ORCPT ); Tue, 26 Jan 2010 16:38:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752489Ab0AZViE (ORCPT ); Tue, 26 Jan 2010 16:38:04 -0500 Received: from mail01d.mail.t-online.hu ([84.2.42.6]:61598 "EHLO mail01d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217Ab0AZViD (ORCPT ); Tue, 26 Jan 2010 16:38:03 -0500 Received: from [192.168.1.67] (dsl51B659B2.pool.t-online.hu [81.182.89.178]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail01d.mail.t-online.hu (Postfix) with ESMTPSA id E525475862D; Tue, 26 Jan 2010 22:35:17 +0100 (CET) Message-ID: <4B5F60B0.7090709@freemail.hu> Date: Tue, 26 Jan 2010 22:37:52 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Laurent Pinchart CC: V4L Mailing List Subject: [PATCH] uvcvideo: check minimum border of control X-DCC-mail.t-online.hu-Metrics: mail01d.mail.t-online.hu 32721; Body=2 Fuz1=2 Fuz2=2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c @@ -1068,6 +1068,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES)); xctrl->value = min + (xctrl->value - min + step/2) / step * step; + if (xctrl->value < min) + xctrl->value = min; if (xctrl->value > max) xctrl->value = max; value = xctrl->value;