Skip to contentSkip to conversation

dm integrity: fix error code in dm_integrity_ctr()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm integrity: fix error code in dm_integrity_ctr()

The "r" variable shadows an earlier "r" that has function scope. It means that we accidentally return success instead of an error code. Smatch has a warning for this:

	drivers/md/dm-integrity.c:4503 dm_integrity_ctr()
	warn: missing error code 'r'
Fixes 7eada909bfd7 ("dm: add integrity target")
---
 drivers/md/dm-integrity.c | 2 --
 1 file changed, 2 deletions(-)
drivers/md/dm-integrity.c +0 -2
index 36ae30b73a6e..3d5a0ce123c9 100644
@@ -4494,8 +4494,6 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	}
 
 	if (should_write_sb) {
-		int r;
-
 		init_journal(ic, 0, ic->journal_sections, 0);
 		r = dm_integrity_failed(ic);
 		if (unlikely(r)) {
Signature · 6 lines
2.35.1

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw

Thanks for finding it.

Quoted 9 lines · Dan Carpenter

The "r" variable shadows an earlier "r" that has function scope. It means that we accidentally return success instead of an error code. Smatch has a warning for this:

	drivers/md/dm-integrity.c:4503 dm_integrity_ctr()
	warn: missing error code 'r'
Fixes 7eada909bfd7 ("dm: add integrity target")

add:

Quoted 20 lines
---
 drivers/md/dm-integrity.c | 2 --
 1 file changed, 2 deletions(-)
drivers/md/dm-integrity.c +0 -2
index 36ae30b73a6e..3d5a0ce123c9 100644
@@ -4494,8 +4494,6 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	}
 
 	if (should_write_sb) {
-		int r;
-
 		init_journal(ic, 0, ic->journal_sections, 0);
 		r = dm_integrity_failed(ic);
 		if (unlikely(r)) {
Signature · 1 line
2.35.1