All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
@ 2020-07-16 14:17 ` B K Karthik
  0 siblings, 0 replies; 8+ messages in thread
From: B K Karthik @ 2020-07-16 14:17 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten, Greg Kroah-Hartman, Al Viro,
	Vlastimil Babka, Xiyu Yang, Michel Lespinasse, Divyansh Kamboj,
	devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

fixed sparse warnings by adding a cast in assignment from
void [noderef] __user * to unsigned int __force *
and a reverse cast in argument from
unsigned int * to  unsigned int __user * .

Signed-off-by: B K Karthik <karthik.bk2000@live.com>
---
 drivers/staging/comedi/comedi_fops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 3f70e5dfac39..9cdc1e8a022d 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd,
 	cmd->scan_end_arg = v32.scan_end_arg;
 	cmd->stop_src = v32.stop_src;
 	cmd->stop_arg = v32.stop_arg;
-	cmd->chanlist = compat_ptr(v32.chanlist);
+	cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist);
 	cmd->chanlist_len = v32.chanlist_len;
 	cmd->data = compat_ptr(v32.data);
 	cmd->data_len = v32.data_len;
@@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32,
 	v32.stop_src = cmd->stop_src;
 	v32.stop_arg = cmd->stop_arg;
 	/* Assume chanlist pointer is unchanged. */
-	v32.chanlist = ptr_to_compat(cmd->chanlist);
+	v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist);
 	v32.chanlist_len = cmd->chanlist_len;
 	v32.data = ptr_to_compat(cmd->data);
 	v32.data_len = cmd->data_len;
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
@ 2020-07-16 14:17 ` B K Karthik
  0 siblings, 0 replies; 8+ messages in thread
From: B K Karthik @ 2020-07-16 14:17 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten, Greg Kroah-Hartman, Al Viro,
	Vlastimil Babka, Xiyu Yang, Michel Lespinasse, Divyansh Kamboj,
	devel, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1428 bytes --]

fixed sparse warnings by adding a cast in assignment from
void [noderef] __user * to unsigned int __force *
and a reverse cast in argument from
unsigned int * to  unsigned int __user * .

Signed-off-by: B K Karthik <karthik.bk2000@live.com>
---
 drivers/staging/comedi/comedi_fops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 3f70e5dfac39..9cdc1e8a022d 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd,
 	cmd->scan_end_arg = v32.scan_end_arg;
 	cmd->stop_src = v32.stop_src;
 	cmd->stop_arg = v32.stop_arg;
-	cmd->chanlist = compat_ptr(v32.chanlist);
+	cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist);
 	cmd->chanlist_len = v32.chanlist_len;
 	cmd->data = compat_ptr(v32.data);
 	cmd->data_len = v32.data_len;
@@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32,
 	v32.stop_src = cmd->stop_src;
 	v32.stop_arg = cmd->stop_arg;
 	/* Assume chanlist pointer is unchanged. */
-	v32.chanlist = ptr_to_compat(cmd->chanlist);
+	v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist);
 	v32.chanlist_len = cmd->chanlist_len;
 	v32.data = ptr_to_compat(cmd->data);
 	v32.data_len = cmd->data_len;
-- 
2.20.1


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

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

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
  2020-07-16 14:17 ` B K Karthik
@ 2020-07-16 14:25   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-16 14:25 UTC (permalink / raw)
  To: B K Karthik
  Cc: Ian Abbott, H Hartley Sweeten, Al Viro, Vlastimil Babka,
	Xiyu Yang, Michel Lespinasse, Divyansh Kamboj, devel,
	linux-kernel

On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> fixed sparse warnings by adding a cast in assignment from
> void [noderef] __user * to unsigned int __force *
> and a reverse cast in argument from
> unsigned int * to  unsigned int __user * .
> 
> Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> ---
>  drivers/staging/comedi/comedi_fops.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

What changed from previous versions?

That always goes below the --- line.

Please fix that up and resend a v4.

thanks,

greg k-h

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
@ 2020-07-16 14:25   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-16 14:25 UTC (permalink / raw)
  To: B K Karthik
  Cc: devel, Xiyu Yang, linux-kernel, Ian Abbott, Al Viro,
	Michel Lespinasse, Divyansh Kamboj, Vlastimil Babka

On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> fixed sparse warnings by adding a cast in assignment from
> void [noderef] __user * to unsigned int __force *
> and a reverse cast in argument from
> unsigned int * to  unsigned int __user * .
> 
> Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> ---
>  drivers/staging/comedi/comedi_fops.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

What changed from previous versions?

That always goes below the --- line.

Please fix that up and resend a v4.

thanks,

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

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
  2020-07-16 14:25   ` Greg Kroah-Hartman
@ 2020-07-16 14:28     ` B K Karthik
  -1 siblings, 0 replies; 8+ messages in thread
From: B K Karthik @ 2020-07-16 14:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ian Abbott, H Hartley Sweeten, Al Viro, Vlastimil Babka,
	Xiyu Yang, Michel Lespinasse, Divyansh Kamboj, devel,
	linux-kernel

On Thu, Jul 16, 2020 at 10:25 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> > fixed sparse warnings by adding a cast in assignment from
> > void [noderef] __user * to unsigned int __force *
> > and a reverse cast in argument from
> > unsigned int * to  unsigned int __user * .
> >
> > Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> > ---
> >  drivers/staging/comedi/comedi_fops.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> What changed from previous versions?

As Ian Abbott said "Minor quibble: the reverse cast is actually from
unsigned int * to"

Hence this is a change in the commit description.

>
> That always goes below the --- line.

I did not understand this sir, can you please clarify?

thanks,

karthik

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
@ 2020-07-16 14:28     ` B K Karthik
  0 siblings, 0 replies; 8+ messages in thread
From: B K Karthik @ 2020-07-16 14:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Xiyu Yang, linux-kernel, Ian Abbott, Al Viro,
	Michel Lespinasse, Divyansh Kamboj, Vlastimil Babka

On Thu, Jul 16, 2020 at 10:25 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> > fixed sparse warnings by adding a cast in assignment from
> > void [noderef] __user * to unsigned int __force *
> > and a reverse cast in argument from
> > unsigned int * to  unsigned int __user * .
> >
> > Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> > ---
> >  drivers/staging/comedi/comedi_fops.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> What changed from previous versions?

As Ian Abbott said "Minor quibble: the reverse cast is actually from
unsigned int * to"

Hence this is a change in the commit description.

>
> That always goes below the --- line.

I did not understand this sir, can you please clarify?

thanks,

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

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
  2020-07-16 14:28     ` B K Karthik
@ 2020-07-16 14:39       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-16 14:39 UTC (permalink / raw)
  To: B K Karthik
  Cc: devel, Xiyu Yang, linux-kernel, Ian Abbott, Al Viro,
	Michel Lespinasse, Divyansh Kamboj, Vlastimil Babka

On Thu, Jul 16, 2020 at 10:28:06AM -0400, B K Karthik wrote:
> On Thu, Jul 16, 2020 at 10:25 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> > > fixed sparse warnings by adding a cast in assignment from
> > > void [noderef] __user * to unsigned int __force *
> > > and a reverse cast in argument from
> > > unsigned int * to  unsigned int __user * .
> > >
> > > Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> > > ---
> > >  drivers/staging/comedi/comedi_fops.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > What changed from previous versions?
> 
> As Ian Abbott said "Minor quibble: the reverse cast is actually from
> unsigned int * to"
> 
> Hence this is a change in the commit description.

How was anyone supposed to know this?  :)

> > That always goes below the --- line.
> 
> I did not understand this sir, can you please clarify?

Please read the documentation for how to properly version patches, it's
in the submitting patches document.  Do that and send a v4 for this.

thanks,

greg k-h

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

* Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
@ 2020-07-16 14:39       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-16 14:39 UTC (permalink / raw)
  To: B K Karthik
  Cc: devel, Xiyu Yang, linux-kernel, Ian Abbott, Al Viro,
	Michel Lespinasse, Divyansh Kamboj, Vlastimil Babka

On Thu, Jul 16, 2020 at 10:28:06AM -0400, B K Karthik wrote:
> On Thu, Jul 16, 2020 at 10:25 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote:
> > > fixed sparse warnings by adding a cast in assignment from
> > > void [noderef] __user * to unsigned int __force *
> > > and a reverse cast in argument from
> > > unsigned int * to  unsigned int __user * .
> > >
> > > Signed-off-by: B K Karthik <karthik.bk2000@live.com>
> > > ---
> > >  drivers/staging/comedi/comedi_fops.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > What changed from previous versions?
> 
> As Ian Abbott said "Minor quibble: the reverse cast is actually from
> unsigned int * to"
> 
> Hence this is a change in the commit description.

How was anyone supposed to know this?  :)

> > That always goes below the --- line.
> 
> I did not understand this sir, can you please clarify?

Please read the documentation for how to properly version patches, it's
in the submitting patches document.  Do that and send a v4 for this.

thanks,

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

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

end of thread, other threads:[~2020-07-16 14:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 14:17 [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings B K Karthik
2020-07-16 14:17 ` B K Karthik
2020-07-16 14:25 ` Greg Kroah-Hartman
2020-07-16 14:25   ` Greg Kroah-Hartman
2020-07-16 14:28   ` B K Karthik
2020-07-16 14:28     ` B K Karthik
2020-07-16 14:39     ` Greg Kroah-Hartman
2020-07-16 14:39       ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.