Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 7:19 AM Ian Abbott wrote: > > On 15/07/2020 05:48, B K Karthik wrote: > > fixed a sparse warning by changing the type in > > assignment from void [noderef] __user * to unsigned int * > > (different address space) > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/comedi/comedi_fops.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > b/drivers/staging/comedi/comedi_fops.c > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > That should be: > > 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; > > > > A reverse cast is required in put_compat_cmd(): > > v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); > > Those changes will get rid of the sparse warnings. Thank you for the clarifications Ian. I will make the changes and submit a patch thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On 15/07/2020 05:48, B K Karthik wrote: fixed a sparse warning by changing the type in assignment from void [noderef] __user * to unsigned int * (different address space) Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); That should be: 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; A reverse cast is required in put_compat_cmd(): v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); Those changes will get rid of the sparse warnings. -- -=( Ian Abbott || Web: www.mev.co.uk )=- -=( MEV Ltd. is a company registered in England & Wales. )=- -=( Registered number: 02862268. Registered address:)=- -=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 5:29 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 05:21:01AM -0400, B K Karthik wrote: > > On Wed, Jul 15, 2020 at 5:14 AM Greg Kroah-Hartman > > wrote: > > > > > > On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > > > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > > > wrote: > > > > > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > > > fixed a sparse warning by changing the type in > > > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > > > (different address space) > > > > > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > > > --- > > > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > > > > > Always run your patches through checkpatch before sending them, > > > > > > > so you > > > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > > > > > But the error that's being shown in this patch is something that > > > > > > comes up > > > > > > on its own. > > > > > > > > > > No it is not. > > > > > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > > > > > It does? Where is any trailing whitespace here? That's not the > > > > > issue. > > > > > > > > To give you an example, > > > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > > > was a patch i submitted recently. > > > > This is what checkpatch has to say: > > > > > > > > $ perl scripts/checkpatch.pl -f > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > > ERROR: trailing whitespace > > > > #21: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #23: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #30: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #37: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #44: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #51: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > > > > +-- $ > > > > > > > > total: 6 errors, 0 warnings, 53 lines checked > > > > > > > > NOTE: For some of the reported defects, checkpatch may be able to > > > > mechanically convert to the typical style using --fix or > > > > --fix-inplace. > > > > > > > > NOTE: Whitespace errors detected. > > > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > > has style problems, please review. > > > > > > > > NOTE: If any of the errors are false positives, please report > > > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > > > > > Does this happen only to patches I make? Am I making a silly mistake > > > > while making a patch? > > > > > > I don't get that error at all, here's all I get with that patch: > > this particular patch or > > > > > > $ ./scripts/checkpatch.pl x.patch > > > WARNING: Missing Signed-off-by: line by nominal patch author '' > > > > > > total: 0 errors, 1 warnings, 0 checks, 30 lines checked > > > > sorry,
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 05:21:01AM -0400, B K Karthik wrote: > On Wed, Jul 15, 2020 at 5:14 AM Greg Kroah-Hartman > wrote: > > > > On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > > wrote: > > > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > > fixed a sparse warning by changing the type in > > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > > (different address space) > > > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > > --- > > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > > > Always run your patches through checkpatch before sending them, so > > > > > > you > > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > > > But the error that's being shown in this patch is something that > > > > > comes up > > > > > on its own. > > > > > > > > No it is not. > > > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > > > It does? Where is any trailing whitespace here? That's not the issue. > > > > > > To give you an example, > > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > > was a patch i submitted recently. > > > This is what checkpatch has to say: > > > > > > $ perl scripts/checkpatch.pl -f > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > ERROR: trailing whitespace > > > #21: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > > + $ > > > > > > ERROR: trailing whitespace > > > #23: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > > + $ > > > > > > ERROR: trailing whitespace > > > #30: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > > + $ > > > > > > ERROR: trailing whitespace > > > #37: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > > > + $ > > > > > > ERROR: trailing whitespace > > > #44: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > > > + $ > > > > > > ERROR: trailing whitespace > > > #51: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > > > +-- $ > > > > > > total: 6 errors, 0 warnings, 53 lines checked > > > > > > NOTE: For some of the reported defects, checkpatch may be able to > > > mechanically convert to the typical style using --fix or > > > --fix-inplace. > > > > > > NOTE: Whitespace errors detected. > > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > has style problems, please review. > > > > > > NOTE: If any of the errors are false positives, please report > > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > > > Does this happen only to patches I make? Am I making a silly mistake > > > while making a patch? > > > > I don't get that error at all, here's all I get with that patch: > this particular patch or > > > > $ ./scripts/checkpatch.pl x.patch > > WARNING: Missing Signed-off-by: line by nominal patch author '' > > > > total: 0 errors, 1 warnings, 0 checks, 30 lines checked > > sorry, you've probably done this a million times more than me, but can > you try "perl scripts/checkpatch.pl -f x.patch" ? > checkpatch seems to behave differently this way. Of course it would, "-f" means treat the next argument as a file, not as a patch. This is a patch, not a full file. So you are running this
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
> > > > > > NOTE: For some of the reported defects, checkpatch may be able to > > > mechanically convert to the typical style using --fix or > > > --fix-inplace. > > > > > > NOTE: Whitespace errors detected. > > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > has style problems, please review. > > > > > > NOTE: If any of the errors are false positives, please report > > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > > > Does this happen only to patches I make? Am I making a silly mistake > > > while making a patch? > > > I use 'git format-patch -1' to generate the patch file. > > > If I am going wrong somewhere, please let me know. > > > > Also, The patch I sent (this thread): > > $ perl scripts/checkpatch.pl -f > > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch > > ERROR: trailing whitespace > > #29: FILE: > > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch:29: > > +-- $ > > > > total: 1 errors, 0 warnings, 31 lines checked > > > > NOTE: For some of the reported defects, checkpatch may be able to > > mechanically convert to the typical style using --fix or > > --fix-inplace. > > > > NOTE: Whitespace errors detected. > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch has > > style problems, please review. > > > > NOTE: If any of the errors are false positives, please report > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > Am I using 'git format-patch' or 'checkpatch.pl' the wrong way? > > Are you checking the right thing here? Here's what I got: > > $ ./scripts/checkpatch.pl --terse x.patch > x.patch:19: CHECK: No space is necessary after a cast > x.patch:25: WARNING: Missing Signed-off-by: line by nominal patch author '' > total: 0 errors, 1 warnings, 1 checks, 8 lines checked > > > I use --terse to make it more obvious what the issue is. > > Heck, check it yourself: > > $ b4 am https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b@pesu-pes-edu > Looking up > https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b%40pesu-pes-edu > Grabbing thread from lore.kernel.org/driverdev-devel > Analyzing 7 messages in the thread > --- > Writing > ./20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx > [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to > unsigned int * > --- > Total patches: 1 > --- > Link: https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b@pesu-pes-edu > Base: not found (applies clean to current tree) >git am > ./20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx > > $ ./scripts/checkpatch.pl --terse > 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx > 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx:32: > CHECK: No space is necessary after a cast > 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx:38: > WARNING: Missing Signed-off-by: line by nominal patch author 'B K Karthik > ' > total: 0 errors, 1 warnings, 1 checks, 8 lines checked > > > I used the b4 tool to download your email in mbox form from > lore.kernel.org and then ran checkpatch on it. > > > And the signed-off-by error is real, you need to also fix that. I will check that. I am sorry for wasting your time. But you have accepted a couple of patches from me before that were created the same way. > > Try the above yourself to verify this. I will. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 5:14 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > wrote: > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > fixed a sparse warning by changing the type in > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > (different address space) > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > --- > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > Always run your patches through checkpatch before sending them, so you > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > But the error that's being shown in this patch is something that comes > > > > up > > > > on its own. > > > > > > No it is not. > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > It does? Where is any trailing whitespace here? That's not the issue. > > > > To give you an example, > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > was a patch i submitted recently. > > This is what checkpatch has to say: > > > > $ perl scripts/checkpatch.pl -f > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > ERROR: trailing whitespace > > #21: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > + $ > > > > ERROR: trailing whitespace > > #23: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > + $ > > > > ERROR: trailing whitespace > > #30: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > + $ > > > > ERROR: trailing whitespace > > #37: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > > + $ > > > > ERROR: trailing whitespace > > #44: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > > + $ > > > > ERROR: trailing whitespace > > #51: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > > +-- $ > > > > total: 6 errors, 0 warnings, 53 lines checked > > > > NOTE: For some of the reported defects, checkpatch may be able to > > mechanically convert to the typical style using --fix or > > --fix-inplace. > > > > NOTE: Whitespace errors detected. > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > has style problems, please review. > > > > NOTE: If any of the errors are false positives, please report > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > Does this happen only to patches I make? Am I making a silly mistake > > while making a patch? > > I don't get that error at all, here's all I get with that patch: this particular patch or > > $ ./scripts/checkpatch.pl x.patch > WARNING: Missing Signed-off-by: line by nominal patch author '' > > total: 0 errors, 1 warnings, 0 checks, 30 lines checked sorry, you've probably done this a million times more than me, but can you try "perl scripts/checkpatch.pl -f x.patch" ? checkpatch seems to behave differently this way. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
ease report > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > Does this happen only to patches I make? Am I making a silly mistake > > while making a patch? > > I use 'git format-patch -1' to generate the patch file. > > If I am going wrong somewhere, please let me know. > > Also, The patch I sent (this thread): > $ perl scripts/checkpatch.pl -f > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch > ERROR: trailing whitespace > #29: FILE: > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch:29: > +-- $ > > total: 1 errors, 0 warnings, 31 lines checked > > NOTE: For some of the reported defects, checkpatch may be able to > mechanically convert to the typical style using --fix or --fix-inplace. > > NOTE: Whitespace errors detected. > You may wish to use scripts/cleanpatch or scripts/cleanfile > > ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch has > style problems, please review. > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > Am I using 'git format-patch' or 'checkpatch.pl' the wrong way? Are you checking the right thing here? Here's what I got: $ ./scripts/checkpatch.pl --terse x.patch x.patch:19: CHECK: No space is necessary after a cast x.patch:25: WARNING: Missing Signed-off-by: line by nominal patch author '' total: 0 errors, 1 warnings, 1 checks, 8 lines checked I use --terse to make it more obvious what the issue is. Heck, check it yourself: $ b4 am https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b@pesu-pes-edu Looking up https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b%40pesu-pes-edu Grabbing thread from lore.kernel.org/driverdev-devel Analyzing 7 messages in the thread --- Writing ./20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int * --- Total patches: 1 --- Link: https://lore.kernel.org/r/20200715044813.fww3regsgsbgyp7b@pesu-pes-edu Base: not found (applies clean to current tree) git am ./20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx $ ./scripts/checkpatch.pl --terse 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx:32: CHECK: No space is necessary after a cast 20200715_bkkarthik_staging_comedi_comedi_fops_c_changed_type_in_assignment_to_unsigned_int.mbx:38: WARNING: Missing Signed-off-by: line by nominal patch author 'B K Karthik ' total: 0 errors, 1 warnings, 1 checks, 8 lines checked I used the b4 tool to download your email in mbox form from lore.kernel.org and then ran checkpatch on it. And the signed-off-by error is real, you need to also fix that. Try the above yourself to verify this. thanks, greg k-h
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > wrote: > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > gre...@linuxfoundation.org> wrote: > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > fixed a sparse warning by changing the type in > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > (different address space) > > > > > > > > > > Signed-off-by: B K Karthik > > > > > --- > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > cmd->data = compat_ptr(v32.data); > > > > > cmd->data_len = v32.data_len; > > > > > > > > Always run your patches through checkpatch before sending them, so you > > > > do not have a grumpy maintainer telling you that you have to run > > > > checkpatch on your patch before sending them. > > > > > > > > > > I will. Sorry for that. > > > > > > But the error that's being shown in this patch is something that comes up > > > on its own. > > > > No it is not. > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > It does? Where is any trailing whitespace here? That's not the issue. > > To give you an example, > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > was a patch i submitted recently. > This is what checkpatch has to say: > > $ perl scripts/checkpatch.pl -f > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > ERROR: trailing whitespace > #21: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > + $ > > ERROR: trailing whitespace > #23: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > + $ > > ERROR: trailing whitespace > #30: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > + $ > > ERROR: trailing whitespace > #37: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > + $ > > ERROR: trailing whitespace > #44: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > + $ > > ERROR: trailing whitespace > #51: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > +-- $ > > total: 6 errors, 0 warnings, 53 lines checked > > NOTE: For some of the reported defects, checkpatch may be able to > mechanically convert to the typical style using --fix or --fix-inplace. > > NOTE: Whitespace errors detected. > You may wish to use scripts/cleanpatch or scripts/cleanfile > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > has style problems, please review. > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > Does this happen only to patches I make? Am I making a silly mistake > while making a patch? I don't get that error at all, here's all I get with that patch: $ ./scripts/checkpatch.pl x.patch WARNING: Missing Signed-off-by: line by nominal patch author '' total: 0 errors, 1 warnings, 0 checks, 30 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. x.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. That warning is because I just saved the body of your email as a patch, watch out when you try to check signed emails like you are doing here. > I use 'git format-patch -1' to generate the patch file. > If I am going wrong somewhere, please let me know. Seems to work for me :) thanks, greg k-h
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 4:41 AM B K Karthik wrote: > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > wrote: > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > gre...@linuxfoundation.org> wrote: > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > fixed a sparse warning by changing the type in > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > (different address space) > > > > > > > > > > Signed-off-by: B K Karthik > > > > > --- > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > cmd->data = compat_ptr(v32.data); > > > > > cmd->data_len = v32.data_len; > > > > > > > > Always run your patches through checkpatch before sending them, so you > > > > do not have a grumpy maintainer telling you that you have to run > > > > checkpatch on your patch before sending them. > > > > > > > > > > I will. Sorry for that. > > > > > > But the error that's being shown in this patch is something that comes up > > > on its own. > > > > No it is not. > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > It does? Where is any trailing whitespace here? That's not the issue. > > To give you an example, > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > was a patch i submitted recently. > This is what checkpatch has to say: > > $ perl scripts/checkpatch.pl -f > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > ERROR: trailing whitespace > #21: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > + $ > > ERROR: trailing whitespace > #23: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > + $ > > ERROR: trailing whitespace > #30: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > + $ > > ERROR: trailing whitespace > #37: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > + $ > > ERROR: trailing whitespace > #44: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > + $ > > ERROR: trailing whitespace > #51: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > +-- $ > > total: 6 errors, 0 warnings, 53 lines checked > > NOTE: For some of the reported defects, checkpatch may be able to > mechanically convert to the typical style using --fix or --fix-inplace. > > NOTE: Whitespace errors detected. > You may wish to use scripts/cleanpatch or scripts/cleanfile > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > has style problems, please review. > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > Does this happen only to patches I make? Am I making a silly mistake > while making a patch? > I use 'git format-patch -1' to generate the patch file. > If I am going wrong somewhere, please let me know. Also, The patch I sent (this thread): $ perl scripts/checkpatch.pl -f ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch ERROR: trailing whitespace #29: FILE: ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch:29: +-- $ total: 1 errors, 0 warnings, 31 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Am I using 'git format-patch' or 'checkpatch.pl' the wrong way? thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > gre...@linuxfoundation.org> wrote: > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > fixed a sparse warning by changing the type in > > > > assignment from void [noderef] __user * to unsigned int * > > > > (different address space) > > > > > > > > Signed-off-by: B K Karthik > > > > --- > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > b/drivers/staging/comedi/comedi_fops.c > > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > > cmd->chanlist_len = v32.chanlist_len; > > > > cmd->data = compat_ptr(v32.data); > > > > cmd->data_len = v32.data_len; > > > > > > Always run your patches through checkpatch before sending them, so you > > > do not have a grumpy maintainer telling you that you have to run > > > checkpatch on your patch before sending them. > > > > > > > I will. Sorry for that. > > > > But the error that's being shown in this patch is something that comes up > > on its own. > > No it is not. > > > git format-patch leaves trailing whitespace in blank lines. > > It does? Where is any trailing whitespace here? That's not the issue. To give you an example, https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ was a patch i submitted recently. This is what checkpatch has to say: $ perl scripts/checkpatch.pl -f ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch ERROR: trailing whitespace #21: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: + $ ERROR: trailing whitespace #23: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: + $ ERROR: trailing whitespace #30: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: + $ ERROR: trailing whitespace #37: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: + $ ERROR: trailing whitespace #44: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: + $ ERROR: trailing whitespace #51: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: +-- $ total: 6 errors, 0 warnings, 53 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Does this happen only to patches I make? Am I making a silly mistake while making a patch? I use 'git format-patch -1' to generate the patch file. If I am going wrong somewhere, please let me know. > > > It has been reported to the maintainers. > > It was? Where? I am extremely sorry, I should have verified if it was indeed reported before telling it out. It has not been reported (yet). I apologise for my mistake. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > gre...@linuxfoundation.org> wrote: > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > fixed a sparse warning by changing the type in > > > assignment from void [noderef] __user * to unsigned int * > > > (different address space) > > > > > > Signed-off-by: B K Karthik > > > --- > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > b/drivers/staging/comedi/comedi_fops.c > > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > > cmd->chanlist_len = v32.chanlist_len; > > > cmd->data = compat_ptr(v32.data); > > > cmd->data_len = v32.data_len; > > > > Always run your patches through checkpatch before sending them, so you > > do not have a grumpy maintainer telling you that you have to run > > checkpatch on your patch before sending them. > > > > I will. Sorry for that. > > But the error that's being shown in this patch is something that comes up > on its own. No it is not. > git format-patch leaves trailing whitespace in blank lines. It does? Where is any trailing whitespace here? That's not the issue. > It has been reported to the maintainers. It was? Where? thanks, greg k-h
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 3:08 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > fixed a sparse warning by changing the type in > > assignment from void [noderef] __user * to unsigned int * > > (different address space) > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/comedi/comedi_fops.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > b/drivers/staging/comedi/comedi_fops.c > > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > > cmd->chanlist_len = v32.chanlist_len; > > cmd->data = compat_ptr(v32.data); > > cmd->data_len = v32.data_len; > > Always run your patches through checkpatch before sending them, so you > do not have a grumpy maintainer telling you that you have to run > checkpatch on your patch before sending them. I will, Sorry for that. But this particular error which showed up after running checkpatch is something 'git format-patch' does unintentionally. It has been reported to the maintainers. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > fixed a sparse warning by changing the type in > assignment from void [noderef] __user * to unsigned int * > (different address space) > > Signed-off-by: B K Karthik > --- > drivers/staging/comedi/comedi_fops.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/comedi/comedi_fops.c > b/drivers/staging/comedi/comedi_fops.c > index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); > cmd->chanlist_len = v32.chanlist_len; > cmd->data = compat_ptr(v32.data); > cmd->data_len = v32.data_len; Always run your patches through checkpatch before sending them, so you do not have a grumpy maintainer telling you that you have to run checkpatch on your patch before sending them. thanks, greg k-h
[PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
fixed a sparse warning by changing the type in assignment from void [noderef] __user * to unsigned int * (different address space) Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..4cc012e231b7 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 *) compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; -- 2.20.1 signature.asc Description: PGP signature