* [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
@ 2016-09-29 9:07 ` SF Markus Elfring
2016-09-29 9:54 ` Paul Bolle
2016-09-29 9:10 ` [PATCH 02/10] dm snapshot: Delete two error messages for a failed memory allocation SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 1 reply; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:07 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 28 Sep 2016 22:20:08 +0200
* Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of data structures by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index c65feea..f262f7e 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -326,8 +326,9 @@ static int init_origin_hash(void)
{
int i;
- _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
- GFP_KERNEL);
+ _origins = kmalloc_array(ORIGIN_HASH_SIZE,
+ sizeof(*_origins),
+ GFP_KERNEL);
if (!_origins) {
DMERR("unable to allocate memory for _origins");
return -ENOMEM;
@@ -335,8 +336,9 @@ static int init_origin_hash(void)
for (i = 0; i < ORIGIN_HASH_SIZE; i++)
INIT_LIST_HEAD(_origins + i);
- _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
- GFP_KERNEL);
+ _dm_origins = kmalloc_array(ORIGIN_HASH_SIZE,
+ sizeof(*_dm_origins),
+ GFP_KERNEL);
if (!_dm_origins) {
DMERR("unable to allocate memory for _dm_origins");
kfree(_origins);
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 9:07 ` [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
@ 2016-09-29 9:54 ` Paul Bolle
2016-09-29 10:02 ` Joe Perches
2016-09-29 11:45 ` dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
0 siblings, 2 replies; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 9:54 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
Andy, Joe,
On Thu, 2016-09-29 at 11:07 +0200, SF Markus Elfring wrote:
> * Multiplications for the size determination of memory allocations
> indicated that array data structures should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
We have no hope of fixing Markus' homegrown coccinelle script. But we
could try to fix the checkpatch false positive here. Something like:
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 206a6b3..b47201d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5693,7 +5693,7 @@ sub process {
$r2 = $a1;
}
if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
- !($r1 =~ /^$Constant$/ || $r1 =~ /^[A-Z_][A-Z0-9_]*$/)) {
+ !($r1 =~ /^$Constant$/ || $r1 =~ /^[A-Z_][A-Z0-9_]*\b/)) {
if (WARN("ALLOC_WITH_MULTIPLY",
"Prefer $newfunc over $oldfunc with multiply\n" . $herecurr) &&
$fix) {
Does that work for you too?
> --- a/drivers/md/dm-snap.c
> +++ b/drivers/md/dm-snap.c
> @@ -326,8 +326,9 @@ static int init_origin_hash(void)
> {
> int i;
>
> - _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
> - GFP_KERNEL);
> + _origins = kmalloc_array(ORIGIN_HASH_SIZE,
> + sizeof(*_origins),
> + GFP_KERNEL);
> if (!_origins) {
> DMERR("unable to allocate memory for _origins");
> return -ENOMEM;
> @@ -335,8 +336,9 @@ static int init_origin_hash(void)
> for (i = 0; i < ORIGIN_HASH_SIZE; i++)
> INIT_LIST_HEAD(_origins + i);
>
> - _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
> - GFP_KERNEL);
> + _dm_origins = kmalloc_array(ORIGIN_HASH_SIZE,
> + sizeof(*_dm_origins),
> + GFP_KERNEL);
> if (!_dm_origins) {
> DMERR("unable to allocate memory for _dm_origins");
> kfree(_origins);
Thanks,
Paul Bolle
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 9:54 ` Paul Bolle
@ 2016-09-29 10:02 ` Joe Perches
2016-09-29 11:12 ` Paul Bolle
2016-09-29 11:45 ` dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
1 sibling, 1 reply; 49+ messages in thread
From: Joe Perches @ 2016-09-29 10:02 UTC (permalink / raw)
To: Paul Bolle, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 11:54 +0200, Paul Bolle wrote:
> Andy, Joe,
>
> On Thu, 2016-09-29 at 11:07 +0200, SF Markus Elfring wrote:
> > * Multiplications for the size determination of memory allocations
> > indicated that array data structures should be processed.
> > Thus use the corresponding function "kmalloc_array".
> >
> > This issue was detected by using the Coccinelle software.
>
>
> We have no hope of fixing Markus' homegrown coccinelle script. But we
> could try to fix the checkpatch false positive here.
What's the false positive?
I get:
$ ./scripts/checkpatch.pl -f drivers/md/dm-snap.c --show-types --types=alloc_with_multiply
WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
#329: FILE: drivers/md/dm-snap.c:329:
+ _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
#338: FILE: drivers/md/dm-snap.c:338:
+ _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
total: 0 errors, 2 warnings, 2490 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.
drivers/md/dm-snap.c has style problems, please review.
NOTE: Used message types: ALLOC_WITH_MULTIPLY
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 10:02 ` Joe Perches
@ 2016-09-29 11:12 ` Paul Bolle
2016-09-29 11:45 ` Paul Bolle
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 11:12 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 03:02 -0700, Joe Perches wrote:
> What's the false positive?
>
> I get:
>
> $ ./scripts/checkpatch.pl -f drivers/md/dm-snap.c --show-types --types=alloc_with_multiply
> WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
> #329: FILE: drivers/md/dm-snap.c:329:
> + _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
>
> WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
> #338: FILE: drivers/md/dm-snap.c:338:
> + _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
>
> total: 0 errors, 2 warnings, 2490 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.
>
> drivers/md/dm-snap.c has style problems, please review.
>
> NOTE: Used message types: ALLOC_WITH_MULTIPLY
>
> NOTE: If any of the errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
It seems it was intended to be silent about multiplying with constants,
where things that look like preprocessor defines are also considered
constants. Or did I misread that test?
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 11:12 ` Paul Bolle
@ 2016-09-29 11:45 ` Paul Bolle
2016-09-29 15:01 ` Joe Perches
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 11:45 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 13:12 +0200, Paul Bolle wrote:
> Or did I misread that test?
I finally did some digging: commit e367455a9f25 ("checkpatch: emit
fewer kmalloc_array/kcalloc conversion warnings") shows I didn't.
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 11:45 ` Paul Bolle
@ 2016-09-29 15:01 ` Joe Perches
2016-09-29 19:43 ` Paul Bolle
0 siblings, 1 reply; 49+ messages in thread
From: Joe Perches @ 2016-09-29 15:01 UTC (permalink / raw)
To: Paul Bolle, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 13:45 +0200, Paul Bolle wrote:
> On Thu, 2016-09-29 at 13:12 +0200, Paul Bolle wrote:
> > Or did I misread that test?
> I finally did some digging: commit e367455a9f25 ("checkpatch: emit
> fewer kmalloc_array/kcalloc conversion warnings") shows I didn't.
You still misread it a little.
I think it's fine as-is.
$Constant there is any number and the match regex is
any upper case variable.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 15:01 ` Joe Perches
@ 2016-09-29 19:43 ` Paul Bolle
2016-09-29 20:24 ` Joe Perches
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 19:43 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 08:01 -0700, Joe Perches wrote:
> $Constant there is any number and the match regex is
> any upper case variable.
Why doesn't that regex match on "ORIGIN_HASH_SIZE"?
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 19:43 ` Paul Bolle
@ 2016-09-29 20:24 ` Joe Perches
2016-09-29 20:39 ` Paul Bolle
0 siblings, 1 reply; 49+ messages in thread
From: Joe Perches @ 2016-09-29 20:24 UTC (permalink / raw)
To: Paul Bolle, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 21:43 +0200, Paul Bolle wrote:
> On Thu, 2016-09-29 at 08:01 -0700, Joe Perches wrote:
> > $Constant there is any number and the match regex is
> > any upper case variable.
> Why doesn't that regex match on "ORIGIN_HASH_SIZE"?
It does match.
Did you see my earlier email?
$ ./scripts/checkpatch.pl -f drivers/md/dm-snap.c --show-types --types=alloc_with_multiply
WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
#329: FILE: drivers/md/dm-snap.c:329:
+ _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
#338: FILE: drivers/md/dm-snap.c:338:
+ _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
total: 0 errors, 2 warnings, 2490 lines checked
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 20:24 ` Joe Perches
@ 2016-09-29 20:39 ` Paul Bolle
2016-09-29 20:56 ` Joe Perches
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 20:39 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 13:24 -0700, Joe Perches wrote:
> On Thu, 2016-09-29 at 21:43 +0200, Paul Bolle wrote:
> > Why doesn't that regex match on "ORIGIN_HASH_SIZE"?
>
> It does match.
If that regex does match, it being part of a negative test, the
specific checkpatch rule should be silent, shouldn't it?
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 20:39 ` Paul Bolle
@ 2016-09-29 20:56 ` Joe Perches
2016-09-29 21:14 ` Paul Bolle
0 siblings, 1 reply; 49+ messages in thread
From: Joe Perches @ 2016-09-29 20:56 UTC (permalink / raw)
To: Paul Bolle, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 22:39 +0200, Paul Bolle wrote:
> On Thu, 2016-09-29 at 13:24 -0700, Joe Perches wrote:
> > On Thu, 2016-09-29 at 21:43 +0200, Paul Bolle wrote:
> > > Why doesn't that regex match on "ORIGIN_HASH_SIZE"?
> > It does match.
> If that regex does match, it being part of a negative test, the
> specific checkpatch rule should be silent, shouldn't it?
'cause I forgot to trim() the original $4 and $10 matches.
Oh well.
It doesn't matter match either way to me.
The case for the unnecessary multiply with <= gcc 4.8 was
removed with:
commit 91c6a05f72a996bee5133e76374ab3ad7d3b9b72
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date: Tue Jul 26 15:22:08 2016 -0700
mm: faster kmalloc_array(), kcalloc()
When both arguments to kmalloc_array() or kcalloc() are known at compile
time then their product is known at compile time but search for kmalloc
cache happens at runtime not at compile time.
Link: http://lkml.kernel.org/r/20160627213454.GA2440@p183.telecom.by
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 20:56 ` Joe Perches
@ 2016-09-29 21:14 ` Paul Bolle
2016-09-29 21:21 ` Joe Perches
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 21:14 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 13:56 -0700, Joe Perches wrote:
> It doesn't matter match either way to me.
>
> The case for the unnecessary multiply with <= gcc 4.8 was
> removed with:
>
> commit 91c6a05f72a996bee5133e76374ab3ad7d3b9b72
> Author: Alexey Dobriyan <adobriyan@gmail.com>
> Date: Tue Jul 26 15:22:08 2016 -0700
>
> mm: faster kmalloc_array(), kcalloc()
>
> When both arguments to kmalloc_array() or kcalloc() are known at compile
> time then their product is known at compile time but search for kmalloc
> cache happens at runtime not at compile time.
>
> Link: http://lkml.kernel.org/r/20160627213454.GA2440@p183.telecom.by
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
You've lost me.
Why does this stop you fixing an apparently wrong checkpatch rule,
crude as parts of it are (ie, uppercase identifier must be a constant)?
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 21:14 ` Paul Bolle
@ 2016-09-29 21:21 ` Joe Perches
2016-09-29 21:42 ` Paul Bolle
0 siblings, 1 reply; 49+ messages in thread
From: Joe Perches @ 2016-09-29 21:21 UTC (permalink / raw)
To: Paul Bolle, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 23:14 +0200, Paul Bolle wrote:
> On Thu, 2016-09-29 at 13:56 -0700, Joe Perches wrote:
> > It doesn't matter match either way to me.
> Why does this stop you fixing an apparently wrong checkpatch rule,
> crude as parts of it are (ie, uppercase identifier must be a constant)?
It doesn't. It just doesn't matter much (match) to me.
Here:
---
scripts/checkpatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3373c65fef1c..fc931d89152e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5835,8 +5835,8 @@ sub process {
if ($^V && $^V ge 5.10.0 &&
$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) {
my $oldfunc = $3;
- my $a1 = $4;
- my $a2 = $10;
+ my $a1 = trim($4);
+ my $a2 = trim($10);
my $newfunc = "kmalloc_array";
$newfunc = "kcalloc" if ($oldfunc eq "kzalloc");
my $r1 = $a1;
@@ -5850,7 +5850,7 @@ sub process {
if (WARN("ALLOC_WITH_MULTIPLY",
"Prefer $newfunc over $oldfunc with multiply\n" . $herecurr) &&
$fix) {
- $fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)/$1 . ' = ' . "$newfunc(" . trim($r1) . ', ' . trim($r2)/e;
+ $fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)/$1 . ' = ' . "$newfunc(" . $r1 . ', ' . $r2/e;
}
}
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 21:21 ` Joe Perches
@ 2016-09-29 21:42 ` Paul Bolle
2016-09-30 7:14 ` dm snapshot: Use kmalloc_array() in init_origin_hash() ? SF Markus Elfring
0 siblings, 1 reply; 49+ messages in thread
From: Paul Bolle @ 2016-09-29 21:42 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft
Cc: SF Markus Elfring, dm-devel, linux-raid, Alasdair Kergon,
Mike Snitzer, Shaohua Li, LKML, kernel-janitors, Julia Lawall
On Thu, 2016-09-29 at 14:21 -0700, Joe Perches wrote:
> > > It doesn't matter match either way to me.
> > Why does this stop you fixing an apparently wrong checkpatch rule,
> > crude as parts of it are (ie, uppercase identifier must be a
> > constant)?
>
> It doesn't. It just doesn't matter much (match) to me.
Joe, please.
I've recently ping-ponged with the kernel's "resident wrong bot of the
day" over this very rule (kmalloc_array() is safer than kmalloc(), so
change your driver now!). Could we just give wrong bots a bit less
ammunition whenever that's feasible?
Even if you don't care about my ping-pong experiences: this checkpatch
test is broken, please just fix it!
Paul Bolle
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: dm snapshot: Use kmalloc_array() in init_origin_hash() ?
2016-09-29 21:42 ` Paul Bolle
@ 2016-09-30 7:14 ` SF Markus Elfring
0 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-30 7:14 UTC (permalink / raw)
To: Paul Bolle
Cc: Joe Perches, Andy Whitcroft, dm-devel, linux-raid,
Alasdair Kergon, Mike Snitzer, Shaohua Li, LKML, kernel-janitors,
Julia Lawall
> I've recently ping-ponged with the kernel's "resident wrong bot of the
> day" over this very rule (kmalloc_array() is safer than kmalloc(), so
> change your driver now!).
Your bot of the day is going to point more update candidates out
in various source files that can "accidentally" belong also to Linux. ;-)
> Could we just give wrong bots a bit less ammunition whenever that's feasible?
How do you think about to clarify constraints any further so that
the probability for false positives can be reduced as desired for
the involved source code analysis tools?
> Even if you don't care about my ping-pong experiences: this checkpatch
> test is broken, please just fix it!
I am curious how collateral software evolution will be continued.
Regards,
Markus
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 9:54 ` Paul Bolle
2016-09-29 10:02 ` Joe Perches
@ 2016-09-29 11:45 ` SF Markus Elfring
2016-09-29 12:59 ` Theodore Ts'o
1 sibling, 1 reply; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 11:45 UTC (permalink / raw)
To: Paul Bolle
Cc: Andy Whitcroft, Joe Perches, dm-devel, linux-raid,
Alasdair Kergon, Mike Snitzer, Shaohua Li, LKML, kernel-janitors,
Julia Lawall, Paolo Bonzini
> We have no hope of fixing Markus' homegrown coccinelle script.
I have got an other impression. I see further possibilities
to clarify involved communication and software development challenges
for a few source code search patterns.
How do you think about to discuss the corresponding collateral evolution
a bit more?
Are there any more constraints to consider?
Regards,
Markus
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: dm snapshot: Use kmalloc_array() in init_origin_hash()
2016-09-29 11:45 ` dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
@ 2016-09-29 12:59 ` Theodore Ts'o
0 siblings, 0 replies; 49+ messages in thread
From: Theodore Ts'o @ 2016-09-29 12:59 UTC (permalink / raw)
To: SF Markus Elfring
Cc: Paul Bolle, Andy Whitcroft, Joe Perches, dm-devel, linux-raid,
Alasdair Kergon, Mike Snitzer, Shaohua Li, LKML, kernel-janitors,
Julia Lawall, Paolo Bonzini
On Thu, Sep 29, 2016 at 01:45:41PM +0200, SF Markus Elfring wrote:
> > We have no hope of fixing Markus' homegrown coccinelle script.
>
> I have got an other impression. I see further possibilities
> to clarify involved communication and software development challenges
> for a few source code search patterns.
>
> How do you think about to discuss the corresponding collateral evolution
> a bit more?
Here's my suggestion:
https://www.youtube.com/watch?v=xAnVNXaa5oA
Regards,
- Ted
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH 02/10] dm snapshot: Delete two error messages for a failed memory allocation
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
2016-09-29 9:07 ` [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
@ 2016-09-29 9:10 ` SF Markus Elfring
2016-09-29 9:11 ` [PATCH 03/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_map() SF Markus Elfring
` (7 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:10 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 28 Sep 2016 22:33:09 +0200
Omit extra messages for a memory allocation failure in this function.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index f262f7e..7d81390 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -329,10 +329,8 @@ static int init_origin_hash(void)
_origins = kmalloc_array(ORIGIN_HASH_SIZE,
sizeof(*_origins),
GFP_KERNEL);
- if (!_origins) {
- DMERR("unable to allocate memory for _origins");
+ if (!_origins)
return -ENOMEM;
- }
for (i = 0; i < ORIGIN_HASH_SIZE; i++)
INIT_LIST_HEAD(_origins + i);
@@ -340,7 +338,6 @@ static int init_origin_hash(void)
sizeof(*_dm_origins),
GFP_KERNEL);
if (!_dm_origins) {
- DMERR("unable to allocate memory for _dm_origins");
kfree(_origins);
return -ENOMEM;
}
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 03/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_map()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
2016-09-29 9:07 ` [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring
2016-09-29 9:10 ` [PATCH 02/10] dm snapshot: Delete two error messages for a failed memory allocation SF Markus Elfring
@ 2016-09-29 9:11 ` SF Markus Elfring
2016-09-29 9:12 ` [PATCH 04/10] dm snapshot: Rename a jump label in pending_complete() SF Markus Elfring
` (6 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:11 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 08:00:29 +0200
The local variable "pe" will be set to an appropriate pointer a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 7d81390..82b7604 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1675,7 +1675,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
struct dm_snapshot *s = ti->private;
int r = DM_MAPIO_REMAPPED;
chunk_t chunk;
- struct dm_snap_pending_exception *pe = NULL;
+ struct dm_snap_pending_exception *pe;
init_tracked_chunk(bio);
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 04/10] dm snapshot: Rename a jump label in pending_complete()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (2 preceding siblings ...)
2016-09-29 9:11 ` [PATCH 03/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_map() SF Markus Elfring
@ 2016-09-29 9:12 ` SF Markus Elfring
2016-09-29 9:13 ` [PATCH 05/10] dm snapshot: Delete unnecessary variable initialisations " SF Markus Elfring
` (5 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:12 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 08:18:51 +0200
Adjust jump labels according to the current Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 82b7604..a6b797f 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1460,7 +1460,7 @@ static void pending_complete(void *context, int success)
down_write(&s->lock);
__invalidate_snapshot(s, -EIO);
error = 1;
- goto out;
+ goto remove_exception;
}
e = alloc_completed_exception(GFP_NOIO);
@@ -1468,7 +1468,7 @@ static void pending_complete(void *context, int success)
down_write(&s->lock);
__invalidate_snapshot(s, -ENOMEM);
error = 1;
- goto out;
+ goto remove_exception;
}
*e = pe->e;
@@ -1476,7 +1476,7 @@ static void pending_complete(void *context, int success)
if (!s->valid) {
free_completed_exception(e);
error = 1;
- goto out;
+ goto remove_exception;
}
/* Check for conflicting reads */
@@ -1487,8 +1487,7 @@ static void pending_complete(void *context, int success)
* in-flight exception from the list.
*/
dm_insert_exception(&s->complete, e);
-
-out:
+remove_exception:
dm_remove_exception(&pe->e);
snapshot_bios = bio_list_get(&pe->snapshot_bios);
origin_bios = bio_list_get(&pe->origin_bios);
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 05/10] dm snapshot: Delete unnecessary variable initialisations in pending_complete()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (3 preceding siblings ...)
2016-09-29 9:12 ` [PATCH 04/10] dm snapshot: Rename a jump label in pending_complete() SF Markus Elfring
@ 2016-09-29 9:13 ` SF Markus Elfring
2016-09-29 9:14 ` [PATCH 06/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_ctr() SF Markus Elfring
` (4 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:13 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 08:25:47 +0200
Three local variables will be set to an appropriate pointer a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index a6b797f..7bbd3c4 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1450,9 +1450,9 @@ static void pending_complete(void *context, int success)
struct dm_snap_pending_exception *pe = context;
struct dm_exception *e;
struct dm_snapshot *s = pe->snap;
- struct bio *origin_bios = NULL;
- struct bio *snapshot_bios = NULL;
- struct bio *full_bio = NULL;
+ struct bio *origin_bios;
+ struct bio *snapshot_bios;
+ struct bio *full_bio;
int error = 0;
if (!success) {
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 06/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_ctr()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (4 preceding siblings ...)
2016-09-29 9:13 ` [PATCH 05/10] dm snapshot: Delete unnecessary variable initialisations " SF Markus Elfring
@ 2016-09-29 9:14 ` SF Markus Elfring
2016-09-29 9:15 ` [PATCH 07/10] dm snapshot: Delete an unnecessary variable initialisation in merge_callback() SF Markus Elfring
` (3 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:14 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 08:38:29 +0200
The local variable "r" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 7bbd3c4..06b1b69 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1102,7 +1102,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
{
struct dm_snapshot *s;
int i;
- int r = -EINVAL;
+ int r;
char *origin_path, *cow_path;
dev_t origin_dev, cow_dev;
unsigned args_used, num_flush_bios = 1;
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 07/10] dm snapshot: Delete an unnecessary variable initialisation in merge_callback()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (5 preceding siblings ...)
2016-09-29 9:14 ` [PATCH 06/10] dm snapshot: Delete an unnecessary variable initialisation in snapshot_ctr() SF Markus Elfring
@ 2016-09-29 9:15 ` SF Markus Elfring
2016-09-29 9:16 ` [PATCH 08/10] dm snapshot: Delete an unnecessary variable initialisation in remove_single_exception_chunk() SF Markus Elfring
` (2 subsequent siblings)
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:15 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 09:00:06 +0200
The local variable "b" will be set to an appropriate pointer a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 06b1b69..1d90131 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1046,7 +1046,7 @@ static void error_bios(struct bio *bio);
static void merge_callback(int read_err, unsigned long write_err, void *context)
{
struct dm_snapshot *s = context;
- struct bio *b = NULL;
+ struct bio *b;
if (read_err || write_err) {
if (read_err)
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 08/10] dm snapshot: Delete an unnecessary variable initialisation in remove_single_exception_chunk()
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (6 preceding siblings ...)
2016-09-29 9:15 ` [PATCH 07/10] dm snapshot: Delete an unnecessary variable initialisation in merge_callback() SF Markus Elfring
@ 2016-09-29 9:16 ` SF Markus Elfring
2016-09-29 9:17 ` [PATCH 09/10] dm snapshot: Combine substrings for seven error messages SF Markus Elfring
2016-09-29 9:18 ` [PATCH 10/10] dm snapshot: Delete five unwanted spaces behind "list_for_each_entry" SF Markus Elfring
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:16 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 09:06:37 +0200
The local variable "b" will be set to an appropriate pointer a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 1d90131..4966584 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -904,7 +904,7 @@ static void flush_bios(struct bio *bio);
static int remove_single_exception_chunk(struct dm_snapshot *s)
{
- struct bio *b = NULL;
+ struct bio *b;
int r;
chunk_t old_chunk = s->first_merging_chunk + s->num_merging_chunks - 1;
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 09/10] dm snapshot: Combine substrings for seven error messages
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (7 preceding siblings ...)
2016-09-29 9:16 ` [PATCH 08/10] dm snapshot: Delete an unnecessary variable initialisation in remove_single_exception_chunk() SF Markus Elfring
@ 2016-09-29 9:17 ` SF Markus Elfring
2016-09-29 9:18 ` [PATCH 10/10] dm snapshot: Delete five unwanted spaces behind "list_for_each_entry" SF Markus Elfring
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:17 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 09:46:32 +0200
The script "checkpatch.pl" can point information out like the following.
WARNING: quoted string split across lines
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 4966584..7593986 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -468,8 +468,7 @@ static int __validate_exception_handover(struct dm_snapshot *snap)
if ((__find_snapshots_sharing_cow(snap, &snap_src, &snap_dest,
&snap_merge) == 2) ||
snap_dest) {
- snap->ti->error = "Snapshot cow pairing for exception "
- "table handover failed";
+ snap->ti->error = "Snapshot cow pairing for exception table handover failed";
return -EINVAL;
}
@@ -496,8 +495,7 @@ static int __validate_exception_handover(struct dm_snapshot *snap)
if (!snap_src->store->type->prepare_merge ||
!snap_src->store->type->commit_merge) {
- snap->ti->error = "Snapshot exception store does not "
- "support snapshot-merge.";
+ snap->ti->error = "Snapshot exception store does not support snapshot-merge.";
return -EINVAL;
}
@@ -858,8 +856,7 @@ static int __remove_single_exception_chunk(struct dm_snapshot *s,
e = dm_lookup_exception(&s->complete, old_chunk);
if (!e) {
- DMERR("Corruption detected: exception for block %llu is "
- "on disk but not in memory",
+ DMERR("Corruption detected: exception for block %llu is on disk but not in memory",
(unsigned long long)old_chunk);
return -EINVAL;
}
@@ -886,8 +883,7 @@ static int __remove_single_exception_chunk(struct dm_snapshot *s,
e->new_chunk++;
} else if (old_chunk != e->old_chunk +
dm_consecutive_chunk_count(e)) {
- DMERR("Attempt to merge block %llu from the "
- "middle of a chunk range [%llu - %llu]",
+ DMERR("Attempt to merge block %llu from the middle of a chunk range [%llu - %llu]",
(unsigned long long)old_chunk,
(unsigned long long)e->old_chunk,
(unsigned long long)
@@ -980,8 +976,7 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s)
&new_chunk);
if (linear_chunks <= 0) {
if (linear_chunks < 0) {
- DMERR("Read error in exception store: "
- "shutting down merge");
+ DMERR("Read error in exception store: shutting down merge");
down_write(&s->lock);
s->merge_failed = 1;
up_write(&s->lock);
@@ -1877,12 +1872,10 @@ static int snapshot_preresume(struct dm_target *ti)
if (snap_src && snap_dest) {
down_read(&snap_src->lock);
if (s == snap_src) {
- DMERR("Unable to resume snapshot source until "
- "handover completes.");
+ DMERR("Unable to resume snapshot source until handover completes.");
r = -EINVAL;
} else if (!dm_suspended(snap_src->ti)) {
- DMERR("Unable to perform snapshot handover until "
- "source is suspended.");
+ DMERR("Unable to perform snapshot handover until source is suspended.");
r = -EINVAL;
}
up_read(&snap_src->lock);
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 10/10] dm snapshot: Delete five unwanted spaces behind "list_for_each_entry"
2016-09-29 9:02 ` [PATCH 00/10] dm snapshot: Fine-tuning for several function implementations SF Markus Elfring
` (8 preceding siblings ...)
2016-09-29 9:17 ` [PATCH 09/10] dm snapshot: Combine substrings for seven error messages SF Markus Elfring
@ 2016-09-29 9:18 ` SF Markus Elfring
9 siblings, 0 replies; 49+ messages in thread
From: SF Markus Elfring @ 2016-09-29 9:18 UTC (permalink / raw)
To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 29 Sep 2016 10:14:32 +0200
The script "checkpatch.pl" can point information out like the following.
WARNING: space prohibited between function name and open parenthesis '('
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-snap.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 7593986..1310652 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -366,7 +366,7 @@ static struct origin *__lookup_origin(struct block_device *origin)
struct origin *o;
ol = &_origins[origin_hash(origin)];
- list_for_each_entry (o, ol, hash_list)
+ list_for_each_entry(o, ol, hash_list)
if (bdev_equal(o->bdev, origin))
return o;
@@ -385,7 +385,7 @@ static struct dm_origin *__lookup_dm_origin(struct block_device *origin)
struct dm_origin *o;
ol = &_dm_origins[origin_hash(origin)];
- list_for_each_entry (o, ol, hash_list)
+ list_for_each_entry(o, ol, hash_list)
if (bdev_equal(o->dev->bdev, origin))
return o;
@@ -625,7 +625,7 @@ static void dm_exception_table_exit(struct dm_exception_table *et,
for (i = 0; i < size; i++) {
slot = et->table + i;
- list_for_each_entry_safe (ex, next, slot, hash_list)
+ list_for_each_entry_safe(ex, next, slot, hash_list)
kmem_cache_free(mem, ex);
}
@@ -653,7 +653,7 @@ static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et,
struct dm_exception *e;
slot = &et->table[exception_hash(et, chunk)];
- list_for_each_entry (e, slot, hash_list)
+ list_for_each_entry(e, slot, hash_list)
if (chunk >= e->old_chunk &&
chunk <= e->old_chunk + dm_consecutive_chunk_count(e))
return e;
@@ -2068,7 +2068,7 @@ static int __origin_write(struct list_head *snapshots, sector_t sector,
chunk_t chunk;
/* Do all the snapshots on this origin */
- list_for_each_entry (snap, snapshots, list) {
+ list_for_each_entry(snap, snapshots, list) {
/*
* Don't make new exceptions in a merging snapshot
* because it has effectively been deleted
--
2.10.0
^ permalink raw reply related [flat|nested] 49+ messages in thread