All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4 v2] Various cleanups
@ 2020-07-16  4:38 Damien Le Moal
  2020-07-16  4:38 ` [PATCH 1/4] dm verity: Fix compilation warning Damien Le Moal
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:38 UTC (permalink / raw)
  To: dm-devel, Mike Snitzer; +Cc: Damien Le Moal

Mike,

These patches fix various compilation warnings showing up when
compiling with W=1. The last patch addresses a static checker warning
(C=1 compilation). There are a lot more of these code checker warnings
remaining that probably could be addressed, some seem to be false
positive though.

Damien Le Moal (4):
  dm verity: Fix compilation warning
  dm raid: Remove empty if statement
  dm ioctl: Fix compilation warning
  dm init: Set file local variable static

 drivers/md/dm-init.c              |  2 +-
 drivers/md/dm-ioctl.c             |  2 +-
 drivers/md/dm-raid.c              |  2 --
 drivers/md/dm-verity-verify-sig.h | 14 +++++++-------
 4 files changed, 9 insertions(+), 11 deletions(-)

Changes from v1:
* Removed md patches to route them through linux-raid

-- 
2.26.2

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

* [PATCH 1/4] dm verity: Fix compilation warning
  2020-07-16  4:38 [PATCH 0/4 v2] Various cleanups Damien Le Moal
@ 2020-07-16  4:38 ` Damien Le Moal
  2020-07-16  4:38 ` [PATCH 2/4] dm raid: Remove empty if statement Damien Le Moal
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:38 UTC (permalink / raw)
  To: dm-devel, Mike Snitzer; +Cc: Damien Le Moal

For the case !CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG, declare the
functions verity_verify_root_hash(), verity_verify_is_sig_opt_arg(),
verity_verify_sig_parse_opt_args() and verity_verify_sig_opts_cleanup()
as inline to avoid a "no previous prototype for xxx" compilation
warning when compiling with W=1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/dm-verity-verify-sig.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-verity-verify-sig.h b/drivers/md/dm-verity-verify-sig.h
index 19b1547aa741..3987c7141f79 100644
--- a/drivers/md/dm-verity-verify-sig.h
+++ b/drivers/md/dm-verity-verify-sig.h
@@ -34,25 +34,25 @@ void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts);
 
 #define DM_VERITY_ROOT_HASH_VERIFICATION_OPTS 0
 
-int verity_verify_root_hash(const void *data, size_t data_len,
-			    const void *sig_data, size_t sig_len)
+static inline int verity_verify_root_hash(const void *data, size_t data_len,
+					  const void *sig_data, size_t sig_len)
 {
 	return 0;
 }
 
-bool verity_verify_is_sig_opt_arg(const char *arg_name)
+static inline bool verity_verify_is_sig_opt_arg(const char *arg_name)
 {
 	return false;
 }
 
-int verity_verify_sig_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v,
-				    struct dm_verity_sig_opts *sig_opts,
-				    unsigned int *argc, const char *arg_name)
+static inline int verity_verify_sig_parse_opt_args(struct dm_arg_set *as,
+			struct dm_verity *v, struct dm_verity_sig_opts *sig_opts,
+			unsigned int *argc, const char *arg_name)
 {
 	return -EINVAL;
 }
 
-void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts)
+static inline void verity_verify_sig_opts_cleanup(struct dm_verity_sig_opts *sig_opts)
 {
 }
 
-- 
2.26.2

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

* [PATCH 2/4] dm raid: Remove empty if statement
  2020-07-16  4:38 [PATCH 0/4 v2] Various cleanups Damien Le Moal
  2020-07-16  4:38 ` [PATCH 1/4] dm verity: Fix compilation warning Damien Le Moal
@ 2020-07-16  4:38 ` Damien Le Moal
  2020-07-16  4:38 ` [PATCH 3/4] dm ioctl: Fix compilation warning Damien Le Moal
  2020-07-16  4:38 ` [PATCH 4/4] dm init: Set file local variable static Damien Le Moal
  3 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:38 UTC (permalink / raw)
  To: dm-devel, Mike Snitzer; +Cc: Damien Le Moal

In super_init_validation(), remove a body-less if statement testing only
variables to avoid a compilation warning when compiling with W=1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/dm-raid.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 10e8b2fe787b..08023c50aaa0 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2345,8 +2345,6 @@ static int super_init_validation(struct raid_set *rs, struct md_rdev *rdev)
 
 	if (new_devs == rs->raid_disks || !rebuilds) {
 		/* Replace a broken device */
-		if (new_devs == 1 && !rs->delta_disks)
-			;
 		if (new_devs == rs->raid_disks) {
 			DMINFO("Superblocks created for new raid set");
 			set_bit(MD_ARRAY_FIRST_USE, &mddev->flags);
-- 
2.26.2

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

* [PATCH 3/4] dm ioctl: Fix compilation warning
  2020-07-16  4:38 [PATCH 0/4 v2] Various cleanups Damien Le Moal
  2020-07-16  4:38 ` [PATCH 1/4] dm verity: Fix compilation warning Damien Le Moal
  2020-07-16  4:38 ` [PATCH 2/4] dm raid: Remove empty if statement Damien Le Moal
@ 2020-07-16  4:38 ` Damien Le Moal
  2020-07-16  4:38 ` [PATCH 4/4] dm init: Set file local variable static Damien Le Moal
  3 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:38 UTC (permalink / raw)
  To: dm-devel, Mike Snitzer; +Cc: Damien Le Moal

In retrieve_status(), when copying the target type name in the
target_type string field of struct dm_target_spec, copy at most
DM_MAX_TYPE_NAME - 1 character to avoid the compilation warning:

warning: ‘__builtin_strncpy’ specified bound 16 equals destination
size [-Wstringop-truncation]

when compiling with W-1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/dm-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 489935d5f22d..5792878dbff6 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1168,7 +1168,7 @@ static void retrieve_status(struct dm_table *table,
 		spec->sector_start = ti->begin;
 		spec->length = ti->len;
 		strncpy(spec->target_type, ti->type->name,
-			sizeof(spec->target_type));
+			sizeof(spec->target_type) - 1);
 
 		outptr += sizeof(struct dm_target_spec);
 		remaining = len - (outptr - outbuf);
-- 
2.26.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

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

* [PATCH 4/4] dm init: Set file local variable static
  2020-07-16  4:38 [PATCH 0/4 v2] Various cleanups Damien Le Moal
                   ` (2 preceding siblings ...)
  2020-07-16  4:38 ` [PATCH 3/4] dm ioctl: Fix compilation warning Damien Le Moal
@ 2020-07-16  4:38 ` Damien Le Moal
  3 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:38 UTC (permalink / raw)
  To: dm-devel, Mike Snitzer; +Cc: Damien Le Moal

Declare dm_allowed_targets as static to avoid the warning:

drivers/md/dm-init.c:39:12: warning: symbol 'dm_allowed_targets' was
not declared. Should it be static?

when compiling with C=1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/dm-init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
index b869316d3722..b0c45c6ebe0b 100644
--- a/drivers/md/dm-init.c
+++ b/drivers/md/dm-init.c
@@ -36,7 +36,7 @@ struct dm_device {
 	struct list_head list;
 };
 
-const char * const dm_allowed_targets[] __initconst = {
+static const char * const dm_allowed_targets[] __initconst = {
 	"crypt",
 	"delay",
 	"linear",
-- 
2.26.2

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  4:38 [PATCH 0/4 v2] Various cleanups Damien Le Moal
2020-07-16  4:38 ` [PATCH 1/4] dm verity: Fix compilation warning Damien Le Moal
2020-07-16  4:38 ` [PATCH 2/4] dm raid: Remove empty if statement Damien Le Moal
2020-07-16  4:38 ` [PATCH 3/4] dm ioctl: Fix compilation warning Damien Le Moal
2020-07-16  4:38 ` [PATCH 4/4] dm init: Set file local variable static Damien Le Moal

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