driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wimax: fix sparse incorrect type issue
@ 2021-02-20 11:34 karthik alapati
  2021-02-22  5:40 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: karthik alapati @ 2021-02-20 11:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mukul Mehar; +Cc: devel, linux-kernel

fix sparse warning by casting to explicit user address-space
pointer type

Signed-off-by: karthik alapati <mail@karthek.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 6f9666dc0..70570e8a5 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);
 	if (IS_ERR(msgbuf)) {
 		result = PTR_ERR(msgbuf);
 		goto bail;
-- 
2.30.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wimax: fix sparse incorrect type issue
  2021-02-20 11:34 [PATCH] staging: wimax: fix sparse incorrect type issue karthik alapati
@ 2021-02-22  5:40 ` Dan Carpenter
  2021-02-22  6:01   ` karthek
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2021-02-22  5:40 UTC (permalink / raw)
  To: karthik alapati; +Cc: devel, Greg Kroah-Hartman, linux-kernel, Mukul Mehar

On Sat, Feb 20, 2021 at 05:04:00PM +0530, karthik alapati wrote:
> fix sparse warning by casting to explicit user address-space
> pointer type
> 
> Signed-off-by: karthik alapati <mail@karthek.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 6f9666dc0..70570e8a5 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);

This doesn't fix anything it just silences the warning.  Linus Torvalds
worked very hard to create Sparse for the express purpose of printing
the warning.  People don't realize that warnings are very valuable
because they show where the bugs are.

Please look at this some more and figure out how to fix the warning.

To be honest, I'm tempted to not accept any patch which doesn't also fix
the buffer overflows when we pass:

	result = p80211req_dorequest(wlandev, msgbuf);

How do we know that "msgbuf" is large enough?

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wimax: fix sparse incorrect type issue
  2021-02-22  5:40 ` Dan Carpenter
@ 2021-02-22  6:01   ` karthek
  2021-02-22  8:10     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: karthek @ 2021-02-22  6:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: devel, Greg Kroah-Hartman, linux-kernel, Mukul Mehar

On Mon, Feb 22, 2021 at 11:10 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Sat, Feb 20, 2021 at 05:04:00PM +0530, karthik alapati wrote:
> > fix sparse warning by casting to explicit user address-space
> > pointer type
> >
> > Signed-off-by: karthik alapati <mail@karthek.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 6f9666dc0..70570e8a5 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);
>
> This doesn't fix anything it just silences the warning.  Linus Torvalds
> worked very hard to create Sparse for the express purpose of printing
> the warning.  People don't realize that warnings are very valuable
> because they show where the bugs are.
>
> Please look at this some more and figure out how to fix the warning.
>
> To be honest, I'm tempted to not accept any patch which doesn't also fix
> the buffer overflows when we pass:
>
>         result = p80211req_dorequest(wlandev, msgbuf);
>
> How do we know that "msgbuf" is large enough?
>
> regards,
> dan carpenter
>

Thanks dan but right after sending this patch i immediately replied to
it stating
to ignore this patch as i found this already applied in staging-testing branch
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing&id=3a8a144d2a754df45127c74e273fa166f690ba43
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: wimax: fix sparse incorrect type issue
  2021-02-22  6:01   ` karthek
@ 2021-02-22  8:10     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-22  8:10 UTC (permalink / raw)
  To: karthek; +Cc: devel, Greg Kroah-Hartman, linux-kernel, Mukul Mehar

On Mon, Feb 22, 2021 at 11:31:48AM +0530, karthek wrote:
> On Mon, Feb 22, 2021 at 11:10 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Sat, Feb 20, 2021 at 05:04:00PM +0530, karthik alapati wrote:
> > > fix sparse warning by casting to explicit user address-space
> > > pointer type
> > >
> > > Signed-off-by: karthik alapati <mail@karthek.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 6f9666dc0..70570e8a5 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);
> >
> > This doesn't fix anything it just silences the warning.  Linus Torvalds
> > worked very hard to create Sparse for the express purpose of printing
> > the warning.  People don't realize that warnings are very valuable
> > because they show where the bugs are.
> >
> > Please look at this some more and figure out how to fix the warning.
> >
> > To be honest, I'm tempted to not accept any patch which doesn't also fix
> > the buffer overflows when we pass:
> >
> >         result = p80211req_dorequest(wlandev, msgbuf);
> >
> > How do we know that "msgbuf" is large enough?
> >
> > regards,
> > dan carpenter
> >
> 
> Thanks dan but right after sending this patch i immediately replied to
> it stating
> to ignore this patch as i found this already applied in staging-testing branch
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing&id=3a8a144d2a754df45127c74e273fa166f690ba43 


It's still possible to fix this in the correct way and fix the buffer
overflows.

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-22  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 11:34 [PATCH] staging: wimax: fix sparse incorrect type issue karthik alapati
2021-02-22  5:40 ` Dan Carpenter
2021-02-22  6:01   ` karthek
2021-02-22  8:10     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).