Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1105260ybi; Fri, 2 Aug 2019 09:23:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8FldmTwzlltLgaqfr9AhV1RpOh8v71ugPfLVwUBYwtCfLSqQLCCHTaWUH+0vkYUTCwX7G X-Received: by 2002:a65:50c5:: with SMTP id s5mr14820958pgp.368.1564762985347; Fri, 02 Aug 2019 09:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564762985; cv=none; d=google.com; s=arc-20160816; b=PSgzt5pjr8d0UOBJl6E3r0TjOeuaILW12QG/KsfJeLPe8WThnhPSXsOUDiVi05naqb z6ewjverKBqlILCu43VLQGOGDyH1VDPS8oI7oe2pjNkWmUtLxTh5Q9mdUytA81QKEEot WhEe0z31JMMSoSgA3F8TqmjfwL6DbdlgJaEq2nTr9enhbfxNwA0Kw/q3UWRgfzOZdUPM AN75drYhNYQWpltYBwROnEoVS6WujwV4ugHEFrkRm4Lov6XVKJDd/CJPc3mlKmiZoW8R yktPd2hoWthjnr7VDE3MjFmWRlH8lgcxBhM/HDFSSU2oCdGp9kxbv2NVsVI/3gls4ZVA 1N/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dZvbgTTR61dtEkLmqd2JuCMvKUZAajkoCNflk90Qd4U=; b=oeEI5+PUqcoH+snS8Zoi5iBxV09QLP/Y6/F57a5aP1Z3uDWjwiPVcpByjliMCwaPDu 1lrdg8VNwye2etMLOCFl/lzdPNJCUMAi2s2rsbhlpfjj1sRsvgphx3GoG3IW5ceILOG0 BQy6OykzFmnVMKNNuUNBssfvFufTqonrO5TSmvbqOr7njAoB3BYNvEsgWh+++NWuQe9O AN74NWLbMvWbpRbLgM8NkAmm2qge6q+ZCdHE5tLF7TcIa3PS+cZgeAA8z/+kAlyW8Aov HmFgatdC3GoccTztdqxuZX0N4FphfCe87ggl1672b6v7pdZZVeYFuSwe77XQx5zDw1sQ TQ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DExCKmEW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x184si26209643pfb.24.2019.08.02.09.22.50; Fri, 02 Aug 2019 09:23:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DExCKmEW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404635AbfHBJle (ORCPT + 99 others); Fri, 2 Aug 2019 05:41:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:43186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391012AbfHBJla (ORCPT ); Fri, 2 Aug 2019 05:41:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E844216C8; Fri, 2 Aug 2019 09:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738889; bh=qpd/yOb7hCGGWr5xjoaoJ/O2mcFbfXdzoQlG2AbF0zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DExCKmEW4rXlvUgOSJTXBxH23OV+itRb9mGMs21glDAzOlJv3clJB4SsNjzN3rAkQ FTOe/bgYUsuRy9V67IIZP+ACCe5IX7+OpnQHtx8IphLTsajEwa8eWcsmAw3GcG3ChH iVy28QW87PfzbBjHNvDWYb+eFes2wCPIzya4HjSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.9 020/223] media: mc-device.c: dont memset __user pointer contents Date: Fri, 2 Aug 2019 11:34:05 +0200 Message-Id: <20190802092240.375444660@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 518fa4e0e0da97ea2e17c95ab57647ce748a96e2 ] You can't memset the contents of a __user pointer. Instead, call copy_to_user to copy links.reserved (which is zeroed) to the user memory. This fixes this sparse warning: SPARSE:drivers/media/mc/mc-device.c drivers/media/mc/mc-device.c:521:16: warning: incorrect type in argument 1 (different address spaces) Fixes: f49308878d720 ("media: media_device_enum_links32: clean a reserved field") Signed-off-by: Hans Verkuil Reviewed-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/media-device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 6062c0cfa632..73a2dba475d0 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -490,8 +490,9 @@ static long media_device_enum_links32(struct media_device *mdev, if (ret) return ret; - memset(ulinks->reserved, 0, sizeof(ulinks->reserved)); - + if (copy_to_user(ulinks->reserved, links.reserved, + sizeof(ulinks->reserved))) + return -EFAULT; return 0; } -- 2.20.1