Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1924571pxy; Fri, 23 Apr 2021 23:06:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX/wsg+Uiz7R9c9XyyBSYNVYxT5hpLved2Em/FLo/61oZd1idFKRwRgDgpqPPgItJ8naOx X-Received: by 2002:a05:6402:31ac:: with SMTP id dj12mr8559375edb.267.1619244373451; Fri, 23 Apr 2021 23:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619244373; cv=none; d=google.com; s=arc-20160816; b=AcvhMicotTJX0cMvgyQ2qKJNUZ9BTrcLde0xEh02hQcwJYUkKpOq1JLYEb0BSV6bus BT07qEanV5iC63EaGK1iGRdNaw8RVBAN5LqoLuqdH3jY4rhAm9cGSRf0TYAx/uvrCUrm +fiZAUxt0x0e/EXLqFPKRnLpQ0qX/f0X3cJzj/K8U9sADf6322JeJiEU9TPB1FNp9+8K SRqiRB/7aKrNUL2BKr9wgPq+k9IFZ/hPPnjsIQhyGv4Inw6GHJXzExujIaTozkjr7M1j aC2z/xHM1HD/JKqD4deWWG2oIP5rfChzvRfqO6T49UpdZoA0WnM0JOV23LPuI4fZOfo3 rmag== 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=0A7Ro1W9JMEP8VV+Sah2uTDjRP53uDyjGtrdviePbQ8=; b=PhRHMGB/SuMJONN6yZtr6dORF0UwTcuEclBtuIKWTCxzl2CrRvtbIUrC9WdP99pykH iQGfYZSEURU38minaa/JW1gRwj1aDJVAjyPPX2Y2VfYfuqGD1QxtxEsNvw17aq/gNtQV 1k46TGaL6sldw9VyA3NS5OGJ4W/wGC3e+X6zvImDstmq9v81vLYLT55ZoiRqKyPJyEcQ /jJlB+n8RK3MvRC2pKKngHxfgNnT6fakzn+TgDbykRJV91WjCq7htFTIQTtAraZBudPj 7JdI+M+un4wthd13riU0cEnnxw5+UEQl14xGLbq1c5XAq0qqDJlLz4hZCzraaHHDZdbU kEpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rIIzwE/f"; 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 ay10si7227144ejb.482.2021.04.23.23.05.49; Fri, 23 Apr 2021 23:06:13 -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="rIIzwE/f"; 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 S231202AbhDXGAz (ORCPT + 99 others); Sat, 24 Apr 2021 02:00:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:40514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhDXGAx (ORCPT ); Sat, 24 Apr 2021 02:00:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 652086137D; Sat, 24 Apr 2021 06:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619244016; bh=5y+JNpXhdcfwvkMSZyc1L+mhCIh3vzIaCOc/xaucCOk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rIIzwE/f2Z1g/HvP86RIhBhxWazNn9/1G1J7uaQXCDlT5QcRqDTdG0Bh6CEH5mHfk PnoqjNrOVbg7b6ixi8Fz0+qwstkc1iIeOHJu4AWD9dZ2t1YjCE/PX9Jd4ezokXZT+4 zUIyw2QyKZVAGPZ8M7S9DGNmPpP8U9WQlvI6AQZI= Date: Sat, 24 Apr 2021 08:00:10 +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? Wait, what is "caddr_t"? Try unwinding that mess first...