Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1923358pxy; Fri, 23 Apr 2021 23:03:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIdZrE+dNNpI9enhouZFSNKp7qADnlZX7g2fJR++4Pi13hPdPbP+asVYsVaVD1rvDmvb2h X-Received: by 2002:aa7:db87:: with SMTP id u7mr8397045edt.16.1619244218823; Fri, 23 Apr 2021 23:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619244218; cv=none; d=google.com; s=arc-20160816; b=xyiSxq+tTH+Zis/nI6HPPcn8nwqkLnPjAZDxmg/vJ6/KFg6T13iedQf3zik+FttbgD U8zojsKtu3/jlXkF2gV61XMJVHub7je365vzUYg0lECAJ7rtqMDs1fqvOUTGApHrv8DI 2qIUSGm9aM9x1JBLUcTMMpZ4F6CPnWRuQ37IeykuqegPdaaF28RxiGP6LQM3jqIzx7+f WMGDU8ySQiMBhf3BFiFnUrmd2kQ0AvaOukFYhZtGnmkKEFmotegNprXgqCoIMFxOV1de jEspyEboyWUDbo9Xy4twZWk5ge/jXOqJE7YcD9fWg3xKjq4+yemOI8MFLSui2dsPBSXT j7hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=C2N1JuOx19gaZ8HdRpBckH0VkjIaqOUNb/vkK63j8uM=; b=JPuCFSHwKdNlC6JDk05SYQ2b6O68aCBRdwz1fCEkUIwZSaUjjger8UpL940AKycNzD cGecUufQViyNt4St8mXN44tPyomX9ZYA2hMr2MtNbVL5qwIiBC5uVixVFPKv/e3qaO7l FHI3e4iOz/S0gb9RWcvKzCpUz/hdcI7XSO6OBJIEv76i3TIN6MxluSjR168RonVOUcRO SGvprAisWODQO97B5Aoto5xMtDgRZZ/QXrylmUOUXU+kBI7J3P6VXGbqh0OIKKzpXb3+ BVYV7KXcQ+J3g22T6dzl2CQ+l4/QdOoWF/c2FA8Pu5R6eza/JpfLMMCa/l2WEPjX+aQl XM7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=InGnb4K6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc43si8456590ejc.529.2021.04.23.23.03.01; Fri, 23 Apr 2021 23:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=InGnb4K6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhDXGA1 (ORCPT + 99 others); Sat, 24 Apr 2021 02:00:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:40224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhDXGA1 (ORCPT ); Sat, 24 Apr 2021 02:00:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2B7761476; Sat, 24 Apr 2021 05:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619243989; bh=Ni5d0JFTtplCZtSRb+Wqkkju1qYBWYjLXRgjMgmIFyY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=InGnb4K6jRYCpaXeCghwec/WL0SusiCBRgQ5c724yz2h8z0rCgtur+RxbVa+m0yH5 k7AttLi405RJ2xAOMHEJTNSEwrb8IfUvcW3EM+vvawhe5y2ETuVXrGXRQImbbq8oOi IMaxMiy3c0aH/2QCzqYMIWtrxRptSfZX88Flc5fQ= Date: Sat, 24 Apr 2021 07:59:44 +0200 From: Greg Kroah-Hartman To: Ashish Kalra Cc: Abheek Dhawan , Johannes Weiner , Romain Perier , Waiman Long , Allen Pais , Ivan Safonov , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: wlan-ng: silence incorrect type in argument 1 (different address spaces) warning Message-ID: References: <20210420090142.GA4086@ashish-NUC8i5BEH> <20210423152619.GA2469@ashish-NUC8i5BEH> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423152619.GA2469@ashish-NUC8i5BEH> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 23, 2021 at 08:56:19PM +0530, Ashish Kalra wrote: > On Thu, Apr 22, 2021 at 10:43:13AM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 20, 2021 at 02:31:42PM +0530, Ashish Kalra wrote: > > > Upon running sparse, "warning: incorrect type in argument 1 (different address spaces) > > > is brought to notice for this file.let's add correct typecast to make it cleaner and > > > silence the Sparse warning. > > > > > > Signed-off-by: Ashish Kalra > > > --- > > > drivers/staging/wlan-ng/p80211netdev.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c > > > index 6f9666dc0277..70570e8a5ad2 100644 > > > --- a/drivers/staging/wlan-ng/p80211netdev.c > > > +++ b/drivers/staging/wlan-ng/p80211netdev.c > > > @@ -569,7 +569,7 @@ static int p80211knetdev_do_ioctl(struct net_device *dev, > > > goto bail; > > > } > > > > > > - msgbuf = memdup_user(req->data, req->len); > > > + msgbuf = memdup_user((void __user *)req->data, req->len); > > > > Why isn't data being declared as a __user pointer to start with? Why is > > the cast needed here? > > > > This feels wrong as if it is papering over the real problem. > > > > thanks, > > > > greg k-h > Thanks for your inputs > variable data in structure p80211ioctl_req is used only inside this function and is > already casted to void __user * for copy_to_user. Should it be changed > to void __user from caadr_t inside p80211ioctl.h. it should be same at runtime > > --- a/drivers/staging/wlan-ng/p80211ioctl.h > +++ b/drivers/staging/wlan-ng/p80211ioctl.h > @@ -81,7 +81,7 @@ > > struct p80211ioctl_req { > char name[WLAN_DEVNAMELEN_MAX]; > - caddr_t data; > + void __user *data; > > Does this looks ok to you and is there any other check possible if this is ok? THat looks better. What does running sparse on that change show? thanks, greg k-h