From patchwork Tue Aug 7 09:24:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas THERY X-Patchwork-Id: 13660 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Syg2I-0001LI-6O for patchwork@linuxtv.org; Tue, 07 Aug 2012 11:25:10 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1Syg2H-00036j-F4; Tue, 07 Aug 2012 11:25:10 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753372Ab2HGJZG (ORCPT ); Tue, 7 Aug 2012 05:25:06 -0400 Received: from eu1sys200aog113.obsmtp.com ([207.126.144.135]:57018 "EHLO eu1sys200aog113.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753350Ab2HGJZF convert rfc822-to-8bit (ORCPT ); Tue, 7 Aug 2012 05:25:05 -0400 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKUCDe72G/fcjHnSvVlrjxjZYquiKkR6a/@postini.com; Tue, 07 Aug 2012 09:25:05 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8FD8A121 for ; Tue, 7 Aug 2012 09:25:02 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas1.st.com [10.75.90.14]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 37AFF2904 for ; Tue, 7 Aug 2012 09:25:02 +0000 (GMT) Received: from SAFEX1MAIL2.st.com ([10.75.90.4]) by SAFEX1HUBCAS1.st.com ([10.75.90.14]) with mapi; Tue, 7 Aug 2012 11:25:01 +0200 From: Nicolas THERY To: "linux-media@vger.kernel.org" Date: Tue, 7 Aug 2012 11:24:59 +0200 Subject: [PATCH] media: fix MEDIA_IOC_DEVICE_INFO return code Thread-Topic: [PATCH] media: fix MEDIA_IOC_DEVICE_INFO return code Thread-Index: Ac10foP+55BZMCCYRYGsn3B/fo7SwA== Message-ID: <5020DEEB.60901@st.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.8.7.91815 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' The MEDIA_IOC_DEVICE_INFO ioctl was returning a positive value rather than a negative error code when failing to copy output parameter to user-space. Tested by compilation only. Signed-off-by: Nicolas Thery --- drivers/media/media-device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 6f9eb94..d01fcb7 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -59,7 +59,9 @@ static int media_device_get_info(struct media_device *dev, info.hw_revision = dev->hw_revision; info.driver_version = dev->driver_version; - return copy_to_user(__info, &info, sizeof(*__info)); + if (copy_to_user(__info, &info, sizeof(*__info))) + return -EFAULT; + return 0; } static struct media_entity *find_entity(struct media_device *mdev, u32 id)