Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9964378ybi; Wed, 24 Jul 2019 13:09:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWOd8q3F7vd3KmkkITjI9mYcEvF070WT9Ym747R8twcmYhrdm0FHW3SDBAWE7MwEX8sx+H X-Received: by 2002:a17:902:7087:: with SMTP id z7mr36235129plk.184.1563998988536; Wed, 24 Jul 2019 13:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563998988; cv=none; d=google.com; s=arc-20160816; b=PcU8xO/hS+8JoAnJWAtyngg5Oo53/75h3RGDFhkB+TeJwhXPuwlfjC06HzkcaSqAg7 bZYP+vULUMFpiON0LdYWT5Z0gBtI8LEyBn33SPA/smvNeFfYnc7Dq7x8vvwjaxXeg/cO 4WllcdzzHncKb6BpMrcHG1p6utUmMQ01uhSM9vjkUN79lndlppD1PhD/lo4xwl1Iu011 1IabWaDl24vnHOZ792OMwGGSzE/vCdCR2FA6Uu9cD/YM6KA2BD77BielPHfxpzEDw33s w6W88LZYKjJus8GlVVxfIX1mAVlrVTzlqsEPRfY3Bmrc0G4uxr2wEgiGZwat0WA2PvLy PPzg== 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=51I0BqkESsiHOAmy6raxZxpSQTAtPvM97r+OvMr5sps=; b=EBpYlhCEsL9vyeLfXgz003Ip6IJCqTXn474N+nCoqUWrJeUH4qSFpN6plO85P6RjXB zj1PPau7a9cIVu6M2pKa9xQLxwcS5rZ85tE8b/eFflzTnpaj6Q0vlsQt51RJBKrvZHCy DxANFpDm+dZY5+zHORhqxEgePxhoELobdnLxf45tD2e/LlJJC8lXc7qWlFPuz3UmcdiC qxov/iVa2ruZuCANb3wUPOc0d3yKmzo4WkcvUrO9XwFDxlnvNiriZVV1VS0KEn3GzTF7 sva/IfGyScUL2bM9svhoMeC+5BJ2acUUmdx8A6dunDSbRylXiF1FSvrmYnhLIAlOvr5P V6fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=geQvMmKw; 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 o9si15988200pfp.158.2019.07.24.13.09.33; Wed, 24 Jul 2019 13:09:48 -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=geQvMmKw; 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 S2405536AbfGXUCf (ORCPT + 99 others); Wed, 24 Jul 2019 16:02:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:52282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405518AbfGXUCa (ORCPT ); Wed, 24 Jul 2019 16:02: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 3F819205C9; Wed, 24 Jul 2019 20:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998549; bh=PhafkKT9+Mzfo9fwfmMpyjNvqPeB13womBUk/A12FjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geQvMmKwgsBdkyXhPFC4KOVe2cfZvGOVqNOvhjyY5H4Dnt9RkoMQfgTmr4gG6OPYy ydpxfTikarp2/aUyydQJregzeyzazPXI0pG4Focku8BpKvKMYzQ8np2V39fp4Lo4+t dNlSdhcgX45wK2JeNier8ET/PsS37WuMYo80s6is= 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.19 031/271] media: mc-device.c: dont memset __user pointer contents Date: Wed, 24 Jul 2019 21:18:20 +0200 Message-Id: <20190724191657.857374912@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 ba344e6f0139..ed518b1f82e4 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -503,8 +503,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