From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B6FCC4360F for ; Tue, 2 Apr 2019 11:34:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24C2D20657 for ; Tue, 2 Apr 2019 11:34:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ts7Re1Ep"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="a08oQr50" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24C2D20657 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U1z/e1DYkKU4mwMqtdw+6i48M8O6MTUTfm5T8TusxHI=; b=Ts7Re1Ep+lwK1M asRntdTibd8xRA95H3K/mNzXJLbw5OcsGjDv9Qn28quWR1mrjOe56/pxRLKs5mcX3pKbtvgByQNqi 82srKNYGoeTZWyKfVoxdosKyUYZohk9IDvOuCNkilOxDTj1a982naRmcz4dsOJMyyvbkwCq4kWdG/ DGbTxdlSvqmfrwBsMz+gt0oLJfhmb523atTJka8Th9r3GYQB8jnhhbzz1mrbQ/4JhhQ1OIlJjZpv4 7w+qRw15c2ZkMaNtJTFTsLdFa59sVlsqQgxQmFCE3SY6NeknNhJxjls3zxdlyKweCtgpubI6v3asE yjDxBqNzmglyGyIWl6dA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBHfy-000123-MD; Tue, 02 Apr 2019 11:33:58 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBHfv-00011N-UB; Tue, 02 Apr 2019 11:33:57 +0000 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89A432F9; Tue, 2 Apr 2019 13:33:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1554204829; bh=WFjwqemxH0pwRmzBB3cMxtC24up2w5vHK0J/fwHG5HU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a08oQr50uzUic0sgdOO1GazP3VfMSXemsYGlzfF1em9Gw7C9x6vV0Y/kf8sdIQ/Or eTkgMsLb3Xcye2i8rfuxCVE5aiw1PHnhPXU+KUi/MESmby9EgTHsCDcXcbt+aN7EbZ Xn1w8NMuAljAfmsa4bqt1ysC3coxoVJqWpR4p594= Date: Tue, 2 Apr 2019 14:33:39 +0300 From: Laurent Pinchart To: Jungo Lin Subject: Re: [PATCH v1] media: media_device_enum_links32: fix missing reserved field copy Message-ID: <20190402113339.GT4805@pendragon.ideasonboard.com> References: <1554199444-16827-1-git-send-email-jungo.lin@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1554199444-16827-1-git-send-email-jungo.lin@mediatek.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190402_043356_120247_5A44BCFE X-CRM114-Status: GOOD ( 15.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ryan.yu@mediatek.com, Jerry-ch.Chen@mediatek.com, laurent.pinchart+renesas@ideasonboard.com, Rynn.Wu@mediatek.com, frankie.chiu@mediatek.com, hans.verkuil@cisco.com, frederic.chen@mediatek.com, seraph.huang@mediatek.com, linux-media@vger.kernel.org, holmes.chiou@mediatek.com, sj.huang@mediatek.com, Jungo Lin , linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, Sean.Cheng@mediatek.com, srv_heupstream@mediatek.com, tfiga@chromium.org, yuzhao@chromium.org, christie.yu@mediatek.com, zwisler@chromium.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jungo, Thank you for the patch. On Tue, Apr 02, 2019 at 06:04:04PM +0800, Jungo Lin wrote: > From: Jungo Lin > > In v4l2-compliance utility, test MEDIA_IOC_ENUM_ENTITIES > will check whether reserved field of media_links_enum filled > with zero. Reserved field is filled with zero in media_device_enum_links. > > However, for 32 bit program, the reserved field is missing > copy from kernel space to user space in media_device_enum_links32 > function. > > This patch copies reserved field of media_links_enum from kernel space > to user space. > > Signed-off-by: Jungo Lin > --- > drivers/media/media-device.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c > index b8ec886..f420829 100644 > --- a/drivers/media/media-device.c > +++ b/drivers/media/media-device.c > @@ -502,6 +502,7 @@ static long media_device_enum_links32(struct media_device *mdev, > { > struct media_links_enum links; > compat_uptr_t pads_ptr, links_ptr; > + int ret; > > memset(&links, 0, sizeof(links)); > > @@ -513,7 +514,15 @@ static long media_device_enum_links32(struct media_device *mdev, > links.pads = compat_ptr(pads_ptr); > links.links = compat_ptr(links_ptr); > > - return media_device_enum_links(mdev, &links); > + ret = media_device_enum_links(mdev, &links); > + if (ret) > + return ret; > + > + if (copy_to_user(ulinks->reserved, &links.reserved, > + sizeof(links.reserved))) > + return -EFAULT; I think it would be better to zero the reserved field here instead of copying it, as we know it has to be zero. > + > + return 0; > } > > #define MEDIA_IOC_ENUM_LINKS32 _IOWR('|', 0x02, struct media_links_enum32) -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel