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: 1284531 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 79601DF280 for ; Tue, 7 Aug 2012 09:25:09 +0000 (UTC) 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 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)