linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
@ 2020-08-02 14:15 Christophe JAILLET
  2020-08-03 15:41 ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Christophe JAILLET @ 2020-08-02 14:15 UTC (permalink / raw)
  To: csully, sagis, jonolson, davem, kuba, lrizzo
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

Update the size used in 'dma_free_coherent()' in order to match the one
used in the corresponding 'dma_alloc_coherent()'.

Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/google/gve/gve_adminq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index c3ba7baf0107..883e173f5ca0 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -322,7 +322,7 @@ int gve_adminq_describe_device(struct gve_priv *priv)
 	priv->default_num_queues = be16_to_cpu(descriptor->default_num_queues);
 
 free_device_descriptor:
-	dma_free_coherent(&priv->pdev->dev, sizeof(*descriptor), descriptor,
+	dma_free_coherent(&priv->pdev->dev, PAGE_SIZE, descriptor,
 			  descriptor_bus);
 	return err;
 }
-- 
2.25.1


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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-02 14:15 [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call Christophe JAILLET
@ 2020-08-03 15:41 ` Jakub Kicinski
  2020-08-03 19:19   ` Christophe JAILLET
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2020-08-03 15:41 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: csully, sagis, jonolson, davem, lrizzo, netdev, linux-kernel,
	kernel-janitors

On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
> Update the size used in 'dma_free_coherent()' in order to match the one
> used in the corresponding 'dma_alloc_coherent()'.
> 
> Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
Has these problem(s):
	- SHA1 should be at least 12 digits long
	  Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
	  or later) just making sure it is not set (or set to "auto").

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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-03 15:41 ` Jakub Kicinski
@ 2020-08-03 19:19   ` Christophe JAILLET
  2020-08-03 19:35     ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Christophe JAILLET @ 2020-08-03 19:19 UTC (permalink / raw)
  To: Jakub Kicinski, Joe Perches
  Cc: csully, sagis, jonolson, davem, lrizzo, netdev, linux-kernel,
	kernel-janitors

Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
> On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
>> Update the size used in 'dma_free_coherent()' in order to match the one
>> used in the corresponding 'dma_alloc_coherent()'.
>>
>> Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> Has these problem(s):
> 	- SHA1 should be at least 12 digits long
> 	  Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
> 	  or later) just making sure it is not set (or set to "auto").
> 

Hi,

I have git 2.25.1 and core.abbrev is already 12, both in my global 
.gitconfig and in the specific .git/gitconfig of my repo.

I would have expected checkpatch to catch this kind of small issue.
Unless I do something wrong, it doesn't.

Joe, does it make sense to you and would one of the following patch help?

If I understand the regex correctly, I guess that checkpatch should 
already spot such things. If correct, proposal 1 fix a bug.
If I'm wrong, proposal 2 adds a new test.

CJ



Proposal #1 : find what looks like a commit number, with 5+ char 
(instead of 12+), before looking if it is looks like a standard layout 
with expected length
===========
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cc5542cc234f..f42b6a65f5c1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2828,7 +2828,7 @@ sub process {
                     $line !~ 
/^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
                     $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
                     ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
-                    ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
+                    ($line =~ /(?:\s|^)[0-9a-f]{5,40}(?:[\s"'\(\[]|$)/i &&
                       $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
                       $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
                         my $init_char = "c";




Proposal #2 : add a specific and explicit check
===========
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cc5542cc234f..13ecfbd38af3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2989,6 +2989,12 @@ sub process {
                         }
                 }

+# check for too short commit id
+               if ($in_commit_log && $line =~ 
/(^fixes:|\bcommit)\s+([0-9a-f]{0,11})\b/i) {
+                               WARN("TOO_SHORT_COMMIT_ID",
+                                    "\"$1\" tag should be at least 12 
chars long. $2 is only " . length($2) . " long\n" . $herecurr);
+               }
+
  # ignore non-hunk lines and lines being removed
                 next if (!$hunk_line || $line =~ /^-/);


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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-03 19:19   ` Christophe JAILLET
@ 2020-08-03 19:35     ` Joe Perches
  2020-08-03 19:50       ` Christophe JAILLET
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2020-08-03 19:35 UTC (permalink / raw)
  To: Christophe JAILLET, Jakub Kicinski
  Cc: csully, sagis, jonolson, davem, lrizzo, netdev, linux-kernel,
	kernel-janitors

On Mon, 2020-08-03 at 21:19 +0200, Christophe JAILLET wrote:
> Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
> > On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
> > > Update the size used in 'dma_free_coherent()' in order to match the one
> > > used in the corresponding 'dma_alloc_coherent()'.
> > > 
> > > Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > 
> > Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> > Has these problem(s):
> > 	- SHA1 should be at least 12 digits long
> > 	  Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
> > 	  or later) just making sure it is not set (or set to "auto").
> > 
> 
> Hi,
> 
> I have git 2.25.1 and core.abbrev is already 12, both in my global 
> .gitconfig and in the specific .git/gitconfig of my repo.
> 
> I would have expected checkpatch to catch this kind of small issue.
> Unless I do something wrong, it doesn't.
> 
> Joe, does it make sense to you and would one of the following patch help?

18 months ago I sent:

https://lore.kernel.org/lkml/40bfc40958fca6e2cc9b86101153aa0715fac4f7.camel@perches.com/



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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-03 19:35     ` Joe Perches
@ 2020-08-03 19:50       ` Christophe JAILLET
  2020-08-03 19:50         ` Christophe JAILLET
  2020-08-04  7:16         ` Willem de Bruijn
  0 siblings, 2 replies; 7+ messages in thread
From: Christophe JAILLET @ 2020-08-03 19:50 UTC (permalink / raw)
  To: Joe Perches, Jakub Kicinski
  Cc: csully, sagis, jonolson, davem, lrizzo, netdev, linux-kernel,
	kernel-janitors

Le 03/08/2020 à 21:35, Joe Perches a écrit :
> On Mon, 2020-08-03 at 21:19 +0200, Christophe JAILLET wrote:
>> Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
>>> On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
>>>> Update the size used in 'dma_free_coherent()' in order to match the one
>>>> used in the corresponding 'dma_alloc_coherent()'.
>>>>
>>>> Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
>>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>>
>>> Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
>>> Has these problem(s):
>>> 	- SHA1 should be at least 12 digits long
>>> 	  Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
>>> 	  or later) just making sure it is not set (or set to "auto").
>>>
>>
>> Hi,
>>
>> I have git 2.25.1 and core.abbrev is already 12, both in my global
>> .gitconfig and in the specific .git/gitconfig of my repo.
>>
>> I would have expected checkpatch to catch this kind of small issue.
>> Unless I do something wrong, it doesn't.
>>
>> Joe, does it make sense to you and would one of the following patch help?
> 
> 18 months ago I sent:
> 
> https://lore.kernel.org/lkml/40bfc40958fca6e2cc9b86101153aa0715fac4f7.camel@perches.com/
> 
> 
> 

Looks like the same spirit.
I've not tested, but doesn't the:
    ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
at the top short cut the rest of the regex?

I read it as "the line should have something that looks like a commit id 
of 12+ char to process further".

So smaller commit id would not be checked.
Did I miss something?


Basically, my proposal is to replace this 12 by a 5 in order to accept 
smaller strings before checking if it looks well formatted or not.

CJ

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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-03 19:50       ` Christophe JAILLET
@ 2020-08-03 19:50         ` Christophe JAILLET
  2020-08-04  7:16         ` Willem de Bruijn
  1 sibling, 0 replies; 7+ messages in thread
From: Christophe JAILLET @ 2020-08-03 19:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, kernel-janitors

Le 03/08/2020 à 21:35, Joe Perches a écrit :
> On Mon, 2020-08-03 at 21:19 +0200, Christophe JAILLET wrote:
>> Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
>>> On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
>>>> Update the size used in 'dma_free_coherent()' in order to match the one
>>>> used in the corresponding 'dma_alloc_coherent()'.
>>>>
>>>> Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
>>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>>
>>> Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
>>> Has these problem(s):
>>> 	- SHA1 should be at least 12 digits long
>>> 	  Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
>>> 	  or later) just making sure it is not set (or set to "auto").
>>>
>>
>> Hi,
>>
>> I have git 2.25.1 and core.abbrev is already 12, both in my global
>> .gitconfig and in the specific .git/gitconfig of my repo.
>>
>> I would have expected checkpatch to catch this kind of small issue.
>> Unless I do something wrong, it doesn't.
>>
>> Joe, does it make sense to you and would one of the following patch help?
> 
> 18 months ago I sent:
> 
> https://lore.kernel.org/lkml/40bfc40958fca6e2cc9b86101153aa0715fac4f7.camel@perches.com/
> 
> 
> 

Looks like the same spirit.
I've not tested, but doesn't the:
    ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
at the top short cut the rest of the regex?

I read it as "the line should have something that looks like a commit id 
of 12+ char to process further".

So smaller commit id would not be checked.
Did I miss something?


Basically, my proposal is to replace this 12 by a 5 in order to accept 
smaller strings before checking if it looks well formatted or not.

CJ


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

* Re: [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call
  2020-08-03 19:50       ` Christophe JAILLET
  2020-08-03 19:50         ` Christophe JAILLET
@ 2020-08-04  7:16         ` Willem de Bruijn
  1 sibling, 0 replies; 7+ messages in thread
From: Willem de Bruijn @ 2020-08-04  7:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Joe Perches, Jakub Kicinski, Catherine Sullivan, Sagi Shahar,
	Jon Olson, David Miller, Luigi Rizzo, Network Development,
	linux-kernel, kernel-janitors

On Mon, Aug 3, 2020 at 9:50 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Le 03/08/2020 à 21:35, Joe Perches a écrit :
> > On Mon, 2020-08-03 at 21:19 +0200, Christophe JAILLET wrote:
> >> Le 03/08/2020 à 17:41, Jakub Kicinski a écrit :
> >>> On Sun,  2 Aug 2020 16:15:23 +0200 Christophe JAILLET wrote:
> >>>> Update the size used in 'dma_free_coherent()' in order to match the one
> >>>> used in the corresponding 'dma_alloc_coherent()'.
> >>>>
> >>>> Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> >>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >>>
> >>> Fixes tag: Fixes: 893ce44df5 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
> >>> Has these problem(s):
> >>>     - SHA1 should be at least 12 digits long
> >>>       Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
> >>>       or later) just making sure it is not set (or set to "auto").
> >>>
> >>
> >> Hi,
> >>
> >> I have git 2.25.1 and core.abbrev is already 12, both in my global
> >> .gitconfig and in the specific .git/gitconfig of my repo.
> >>
> >> I would have expected checkpatch to catch this kind of small issue.
> >> Unless I do something wrong, it doesn't.
> >>
> >> Joe, does it make sense to you and would one of the following patch help?
> >
> > 18 months ago I sent:
> >
> > https://lore.kernel.org/lkml/40bfc40958fca6e2cc9b86101153aa0715fac4f7.camel@perches.com/
> >
> >
> >
>
> Looks like the same spirit.
> I've not tested, but doesn't the:
>     ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
> at the top short cut the rest of the regex?
>
> I read it as "the line should have something that looks like a commit id
> of 12+ char to process further".
>
> So smaller commit id would not be checked.
> Did I miss something?
>
>
> Basically, my proposal is to replace this 12 by a 5 in order to accept
> smaller strings before checking if it looks well formatted or not.

My attempt from a few years ago: https://lore.kernel.org/patchwork/patch/911726/

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

end of thread, other threads:[~2020-08-04  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 14:15 [PATCH] gve: Fix the size used in a 'dma_free_coherent()' call Christophe JAILLET
2020-08-03 15:41 ` Jakub Kicinski
2020-08-03 19:19   ` Christophe JAILLET
2020-08-03 19:35     ` Joe Perches
2020-08-03 19:50       ` Christophe JAILLET
2020-08-03 19:50         ` Christophe JAILLET
2020-08-04  7:16         ` Willem de Bruijn

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).