Message ID | 20170508222819.GA14833@amd (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1d7r8k-0007ML-3o; Mon, 08 May 2017 22:28:26 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-5) with esmtp id 1d7r8h-0007Qx-94; Tue, 09 May 2017 00:28:25 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115AbdEHW2W (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 8 May 2017 18:28:22 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:48582 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbdEHW2W (ORCPT <rfc822; linux-media@vger.kernel.org>); Mon, 8 May 2017 18:28:22 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 0A88681A18; Tue, 9 May 2017 00:28:19 +0200 (CEST) Date: Tue, 9 May 2017 00:28:19 +0200 From: Pavel Machek <pavel@ucw.cz> To: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>, pali.rohar@gmail.com, sre@kernel.org, Sakari Ailus <sakari.ailus@iki.fi>, Sakari Ailus <sakari.ailus@linux.intel.com>, linux-media@vger.kernel.org, hans.verkuil@cisco.com Subject: [patch, libv4l]: fix integer overflow Message-ID: <20170508222819.GA14833@amd> References: <20170416091209.GB7456@valkosipuli.retiisi.org.uk> <20170419105118.72b8e284@vento.lan> <20170424093059.GA20427@amd> <20170424103802.00d3b554@vento.lan> <20170424212914.GA20780@amd> <20170424224724.5bb52382@vento.lan> <20170426105300.GA857@amd> <20170426081330.6ca10e42@vento.lan> <20170426132337.GA6482@amd> <cedfd68d-d0fe-6fa8-2676-b61f3ddda652@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: <cedfd68d-d0fe-6fa8-2676-b61f3ddda652@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.5.8.222116 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' BODY_PARA_IS_SENTENCE_URL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, KNOWN_FREEWEB_URI 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1900_1999 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, INVALID_MSGID_NO_FQDN 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, URI_ENDS_IN_HTML 0, URI_WITH_PATH_ONLY 0, __ANY_URI 0, __ATTACHMENT_SIZE_0_10K 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CD 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __HAS_ATTACHMENT 0, __HAS_ATTACHMENT1 0, __HAS_ATTACHMENT2 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __KNOWN_FREEWEB_URI2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __MULTIPLE_URI_TEXT 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_IN_BODY 0, __URI_NOT_IMG 0, __URI_NS , __URI_WITH_PATH 0, __USER_AGENT 0' |
Commit Message
Pavel Machek
May 8, 2017, 10:28 p.m. UTC
Hi! This bit me while trying to use absolute exposure time on Nokia N900: Can someone apply it to libv4l2 tree? Could I get some feedback on the other patches? Is this the way to submit patches to libv4l2? Thanks, Pavel commit 0484e39ec05fdc644191e7c334a7ebfff9cb2ec5 Author: Pavel <pavel@ucw.cz> Date: Mon May 8 21:52:02 2017 +0200 Fix integer overflow with EXPOSURE_ABSOLUTE.
Comments
On 05/09/2017 12:28 AM, Pavel Machek wrote: > Hi! > > This bit me while trying to use absolute exposure time on Nokia N900: > > Can someone apply it to libv4l2 tree? Could I get some feedback on the > other patches? Is this the way to submit patches to libv4l2? Yes, it is. But I do need a Signed-off-by from you. Regards, Hans > > Thanks, > Pavel > > commit 0484e39ec05fdc644191e7c334a7ebfff9cb2ec5 > Author: Pavel <pavel@ucw.cz> > Date: Mon May 8 21:52:02 2017 +0200 > > Fix integer overflow with EXPOSURE_ABSOLUTE. > > diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c > index e795aee..189fc06 100644 > --- a/lib/libv4l2/libv4l2.c > +++ b/lib/libv4l2/libv4l2.c > @@ -1776,7 +1776,7 @@ int v4l2_set_control(int fd, int cid, int value) > if (qctrl.type == V4L2_CTRL_TYPE_BOOLEAN) > ctrl.value = value ? 1 : 0; > else > - ctrl.value = (value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + > + ctrl.value = ((long long) value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + > qctrl.minimum; > > result = v4lconvert_vidioc_s_ctrl(devices[index].convert, &ctrl); > @@ -1812,7 +1812,7 @@ int v4l2_get_control(int fd, int cid) > if (v4l2_propagate_ioctl(index, VIDIOC_G_CTRL, &ctrl)) > return -1; > > - return ((ctrl.value - qctrl.minimum) * 65535 + > + return (((long long) ctrl.value - qctrl.minimum) * 65535 + > (qctrl.maximum - qctrl.minimum) / 2) / > (qctrl.maximum - qctrl.minimum); > } > >
On 05/09/2017 08:29 AM, Hans Verkuil wrote: > On 05/09/2017 12:28 AM, Pavel Machek wrote: >> Hi! >> >> This bit me while trying to use absolute exposure time on Nokia N900: >> >> Can someone apply it to libv4l2 tree? Could I get some feedback on the >> other patches? Is this the way to submit patches to libv4l2? > > Yes, it is. But I do need a Signed-off-by from you. I saw other patches from you for libv4l without a Signed-off-by. Can you check them and reply with the Signed-off-by line? Thanks! Hans > > Regards, > > Hans > >> >> Thanks, >> Pavel >> >> commit 0484e39ec05fdc644191e7c334a7ebfff9cb2ec5 >> Author: Pavel <pavel@ucw.cz> >> Date: Mon May 8 21:52:02 2017 +0200 >> >> Fix integer overflow with EXPOSURE_ABSOLUTE. >> >> diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c >> index e795aee..189fc06 100644 >> --- a/lib/libv4l2/libv4l2.c >> +++ b/lib/libv4l2/libv4l2.c >> @@ -1776,7 +1776,7 @@ int v4l2_set_control(int fd, int cid, int value) >> if (qctrl.type == V4L2_CTRL_TYPE_BOOLEAN) >> ctrl.value = value ? 1 : 0; >> else >> - ctrl.value = (value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + >> + ctrl.value = ((long long) value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + >> qctrl.minimum; >> >> result = v4lconvert_vidioc_s_ctrl(devices[index].convert, &ctrl); >> @@ -1812,7 +1812,7 @@ int v4l2_get_control(int fd, int cid) >> if (v4l2_propagate_ioctl(index, VIDIOC_G_CTRL, &ctrl)) >> return -1; >> >> - return ((ctrl.value - qctrl.minimum) * 65535 + >> + return (((long long) ctrl.value - qctrl.minimum) * 65535 + >> (qctrl.maximum - qctrl.minimum) / 2) / >> (qctrl.maximum - qctrl.minimum); >> } >> >> >
On Tue 2017-05-09 08:32:20, Hans Verkuil wrote: > On 05/09/2017 08:29 AM, Hans Verkuil wrote: > > On 05/09/2017 12:28 AM, Pavel Machek wrote: > >> Hi! > >> > >> This bit me while trying to use absolute exposure time on Nokia N900: > >> > >> Can someone apply it to libv4l2 tree? Could I get some feedback on the > >> other patches? Is this the way to submit patches to libv4l2? > > > > Yes, it is. But I do need a Signed-off-by from you. > > I saw other patches from you for libv4l without a Signed-off-by. Can you > check them and reply with the Signed-off-by line? Thanks for quick reply. Yes, will do. Best regards, Pavel
Hi! > > This bit me while trying to use absolute exposure time on Nokia N900: > > > > Can someone apply it to libv4l2 tree? Could I get some feedback on the > > other patches? Is this the way to submit patches to libv4l2? > > Yes, it is. But I do need a Signed-off-by from you. Ok, that should be it for today. I also put all but the first patch into the git, at https://gitlab.com/tui/v4l-utils/tree/merge Best regards, Pavel
Hi! > > This bit me while trying to use absolute exposure time on Nokia N900: > > > > Can someone apply it to libv4l2 tree? Could I get some feedback on the > > other patches? Is this the way to submit patches to libv4l2? > > Yes, it is. But I do need a Signed-off-by from you. Ping? Can I get you to apply the patches? Thanks, Pavel
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c index e795aee..189fc06 100644 --- a/lib/libv4l2/libv4l2.c +++ b/lib/libv4l2/libv4l2.c @@ -1776,7 +1776,7 @@ int v4l2_set_control(int fd, int cid, int value) if (qctrl.type == V4L2_CTRL_TYPE_BOOLEAN) ctrl.value = value ? 1 : 0; else - ctrl.value = (value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + + ctrl.value = ((long long) value * (qctrl.maximum - qctrl.minimum) + 32767) / 65535 + qctrl.minimum; result = v4lconvert_vidioc_s_ctrl(devices[index].convert, &ctrl); @@ -1812,7 +1812,7 @@ int v4l2_get_control(int fd, int cid) if (v4l2_propagate_ioctl(index, VIDIOC_G_CTRL, &ctrl)) return -1; - return ((ctrl.value - qctrl.minimum) * 65535 + + return (((long long) ctrl.value - qctrl.minimum) * 65535 + (qctrl.maximum - qctrl.minimum) / 2) / (qctrl.maximum - qctrl.minimum); }