Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3783406ybi; Mon, 29 Jul 2019 12:32:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzt13oH3obulgScFcWwfZt5T/ANqWfc6XVKH1qUFEinUSSz/G9o5yDQ2JQPzEiUXeJu9T+ X-Received: by 2002:a17:902:5c3:: with SMTP id f61mr103634533plf.98.1564428759798; Mon, 29 Jul 2019 12:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428759; cv=none; d=google.com; s=arc-20160816; b=Oil/KekWZrVtQWY3ASiLNs69/RLopRS4Rg6nYuFWIlRpTUdwBvVOi6Ik6pJd2qPmqM MeN6oW6fEIIwmKCgCHW7ibkqwu86NLzuHUHBlf6m3YsIKYxJ1qtYjuVncdyMBYmtG+ti gcTUFN4jaNH4Y+LjtQIqFf5YStmAbnzKrE2SsSWe8ZOAwaa+QG0NC6iS9LPpztUHCDGW gq9PYORvfCPLoa139Zt8tLXuC/HK9l6v2KmiwzrVPaLAnFG9N+50b9S4hB3cKWjVjxgt v3NnFS/nIqI+DzbyHeih9nUeuPhuTDVYZwOiJBt70KEUAJOs8vC3BsQFzjdytx5s9oWf cHPQ== 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=S1QP5FpJPLVN9WAfQqGqOKRpgPfNwWNGq56P+waxddo=; b=gxcbIMZWvwftEqvbxINNtToaT0LXFaivirxbSqenZR4d15Rg97MFlyslZZjx1N8AiX 87EeLUszwW4fo6F+ii7pWYb8Adw99gJmitsHkF1gvkbmt4ss7iUXsyXYfMzdc2bYPckU oTBYHbjvTejYm2TZUXIFYRgNLtlyEfwXER7kQppzss6ShLoURtDCKMP6F2N0futIAgWp LSHYnRqca+SuUd8Iz+t8tPNmCSdYK18Kudxwj9HfEysg2jqMv4LMypwTPiR7IhqMWgZy Y1tu0RjHBn5dUNSpe2u4nDNfqAZjriYW9R8fFnGkD/9U+/vSD2y/j/id+NBmQNQ/6ySG 0yWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Egyx5cb6; 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 x16si30414775pgi.312.2019.07.29.12.32.24; Mon, 29 Jul 2019 12:32:39 -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=Egyx5cb6; 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 S1729806AbfG2T0n (ORCPT + 99 others); Mon, 29 Jul 2019 15:26:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:39122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729793AbfG2T0j (ORCPT ); Mon, 29 Jul 2019 15:26:39 -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 92179216C8; Mon, 29 Jul 2019 19:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428399; bh=h0JsN0BwHh3MpJJOiJZT34Tdihv9K2+y44PteLNWKoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Egyx5cb6vvb5NpMVU1Tn+++pE+/rpCskfaexb7PQ03oPQLhC6qwVjlLm1Iy9BuYIu 9n3KzSJANLgccPbBGDKTtaL85ZItHzo1FeiJi03+6PrT44WvgbHsXbKXFziw+ralRD hvrZespzBtfVxkl0w106ydgoRShV68f6cdDjHsPI= 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.14 025/293] media: mc-device.c: dont memset __user pointer contents Date: Mon, 29 Jul 2019 21:18:36 +0200 Message-Id: <20190729190823.362359878@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 a6d56154fac7..4eb51a618fe1 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -486,8 +486,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