lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIOz6o8gwHv+cAN7@kroah.com>
Date:   Sat, 24 Apr 2021 08:00:10 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Ashish Kalra <eashishkalra@...il.com>
Cc:     Abheek Dhawan <adawesomeguy222@...il.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Romain Perier <romain.perier@...il.com>,
        Waiman Long <longman@...hat.com>,
        Allen Pais <apais@...ux.microsoft.com>,
        Ivan Safonov <insafonov@...il.com>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: wlan-ng: silence incorrect type in argument 1
 (different address spaces) warning

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 <eashishkalra@...il.com>
> > > ---
> > >  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...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ