* [PATCH] target: iscsi: fix clang -Wformat warning @ 2022-07-08 21:14 Justin Stitt 2022-07-08 23:42 ` Nick Desaulniers 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt 0 siblings, 2 replies; 7+ messages in thread From: Justin Stitt @ 2022-07-08 21:14 UTC (permalink / raw) To: Martin K . Petersen Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Mike Christie, Max Gurtovoy, Mingzhe Zou, Justin Stitt, linux-scsi, target-devel, linux-kernel, llvm When building with Clang we encounter these warnings: | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), - | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), For both warnings, the format specifier is `%hu` which describes an unsigned short. The resulting type of atomic_read is an int. The proposed fix is to listen to Clang and swap the format specifier. Link: https://github.com/ClangBuiltLinux/linux/issues/378 Signed-off-by: Justin Stitt <justinstitt@google.com> --- drivers/target/iscsi/iscsi_target_login.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 6b94eecc4790..0778591abae7 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -715,7 +715,7 @@ void iscsi_post_login_handler( list_add_tail(&conn->conn_list, &sess->sess_conn_list); atomic_inc(&sess->nconn); - pr_debug("Incremented iSCSI Connection count to %hu" + pr_debug("Incremented iSCSI Connection count to %d" " from node: %s\n", atomic_read(&sess->nconn), sess->sess_ops->InitiatorName); spin_unlock_bh(&sess->conn_lock); @@ -763,7 +763,7 @@ void iscsi_post_login_handler( spin_lock_bh(&sess->conn_lock); list_add_tail(&conn->conn_list, &sess->sess_conn_list); atomic_inc(&sess->nconn); - pr_debug("Incremented iSCSI Connection count to %hu from node:" + pr_debug("Incremented iSCSI Connection count to %d from node:" " %s\n", atomic_read(&sess->nconn), sess->sess_ops->InitiatorName); spin_unlock_bh(&sess->conn_lock); -- 2.37.0.rc0.161.g10f37bed90-goog ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] target: iscsi: fix clang -Wformat warning 2022-07-08 21:14 [PATCH] target: iscsi: fix clang -Wformat warning Justin Stitt @ 2022-07-08 23:42 ` Nick Desaulniers 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt 1 sibling, 0 replies; 7+ messages in thread From: Nick Desaulniers @ 2022-07-08 23:42 UTC (permalink / raw) To: Justin Stitt Cc: Martin K . Petersen, Nathan Chancellor, Tom Rix, Mike Christie, Max Gurtovoy, Mingzhe Zou, linux-scsi, target-devel, linux-kernel, llvm On Fri, Jul 8, 2022 at 2:15 PM Justin Stitt <justinstitt@google.com> wrote: > > When building with Clang we encounter these warnings: > | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), > > For both warnings, the format specifier is `%hu` which describes an > unsigned short. The resulting type of atomic_read is an int. The > proposed fix is to listen to Clang and swap the format specifier. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt <justinstitt@google.com> See also: https://lore.kernel.org/lkml/CAKwvOd=uOrDe5DWnXn7fx8+kTCF6gQVYhgqpnDFbaKunfBBVVg@mail.gmail.com/ > --- > drivers/target/iscsi/iscsi_target_login.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c > index 6b94eecc4790..0778591abae7 100644 > --- a/drivers/target/iscsi/iscsi_target_login.c > +++ b/drivers/target/iscsi/iscsi_target_login.c > @@ -715,7 +715,7 @@ void iscsi_post_login_handler( > > list_add_tail(&conn->conn_list, &sess->sess_conn_list); > atomic_inc(&sess->nconn); > - pr_debug("Incremented iSCSI Connection count to %hu" > + pr_debug("Incremented iSCSI Connection count to %d" > " from node: %s\n", atomic_read(&sess->nconn), > sess->sess_ops->InitiatorName); > spin_unlock_bh(&sess->conn_lock); > @@ -763,7 +763,7 @@ void iscsi_post_login_handler( > spin_lock_bh(&sess->conn_lock); > list_add_tail(&conn->conn_list, &sess->sess_conn_list); > atomic_inc(&sess->nconn); > - pr_debug("Incremented iSCSI Connection count to %hu from node:" > + pr_debug("Incremented iSCSI Connection count to %d from node:" > " %s\n", atomic_read(&sess->nconn), > sess->sess_ops->InitiatorName); > spin_unlock_bh(&sess->conn_lock); > -- > 2.37.0.rc0.161.g10f37bed90-goog > -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] target: iscsi: fix clang -Wformat warnings 2022-07-08 21:14 [PATCH] target: iscsi: fix clang -Wformat warning Justin Stitt 2022-07-08 23:42 ` Nick Desaulniers @ 2022-07-18 18:04 ` Justin Stitt 2022-07-18 20:55 ` Nick Desaulniers ` (3 more replies) 1 sibling, 4 replies; 7+ messages in thread From: Justin Stitt @ 2022-07-18 18:04 UTC (permalink / raw) To: justinstitt Cc: linux-kernel, linux-scsi, llvm, martin.petersen, mgurtovoy, michael.christie, mingzhe.zou, nathan, ndesaulniers, target-devel, trix When building with Clang we encounter these warnings: | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), - | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), - | drivers/target/iscsi/iscsi_target.c:4365:12: error: format specifies | type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] | " %s\n", atomic_read(&sess->nconn) For all warnings, the format specifier is `%hu` which describes an unsigned short. The resulting type of atomic_read is an int. The proposed fix is to listen to Clang and swap the format specifier. Link: https://github.com/ClangBuiltLinux/linux/issues/378 Signed-off-by: Justin Stitt <justinstitt@google.com> --- diff from v1->v2: Combined two similar patches into one: * https://lore.kernel.org/all/20220708221314.466294-1-justinstitt@google.com/ * https://lore.kernel.org/llvm/20220708211447.135209-1-justinstitt@google.com/ drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/iscsi/iscsi_target_login.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index e368f038ff5c..bfb717065344 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4361,7 +4361,7 @@ int iscsit_close_connection( spin_lock_bh(&sess->conn_lock); atomic_dec(&sess->nconn); - pr_debug("Decremented iSCSI connection count to %hu from node:" + pr_debug("Decremented iSCSI connection count to %d from node:" " %s\n", atomic_read(&sess->nconn), sess->sess_ops->InitiatorName); /* diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 6b94eecc4790..0778591abae7 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -715,7 +715,7 @@ void iscsi_post_login_handler( list_add_tail(&conn->conn_list, &sess->sess_conn_list); atomic_inc(&sess->nconn); - pr_debug("Incremented iSCSI Connection count to %hu" + pr_debug("Incremented iSCSI Connection count to %d" " from node: %s\n", atomic_read(&sess->nconn), sess->sess_ops->InitiatorName); spin_unlock_bh(&sess->conn_lock); @@ -763,7 +763,7 @@ void iscsi_post_login_handler( spin_lock_bh(&sess->conn_lock); list_add_tail(&conn->conn_list, &sess->sess_conn_list); atomic_inc(&sess->nconn); - pr_debug("Incremented iSCSI Connection count to %hu from node:" + pr_debug("Incremented iSCSI Connection count to %d from node:" " %s\n", atomic_read(&sess->nconn), sess->sess_ops->InitiatorName); spin_unlock_bh(&sess->conn_lock); -- 2.37.0.170.g444d1eabd0-goog ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] target: iscsi: fix clang -Wformat warnings 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt @ 2022-07-18 20:55 ` Nick Desaulniers 2022-07-18 21:35 ` Chaitanya Kulkarni ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Nick Desaulniers @ 2022-07-18 20:55 UTC (permalink / raw) To: martin.petersen Cc: linux-kernel, linux-scsi, llvm, mgurtovoy, michael.christie, mingzhe.zou, nathan, target-devel, trix, Justin Stitt On Mon, Jul 18, 2022 at 11:04 AM Justin Stitt <justinstitt@google.com> wrote: > > When building with Clang we encounter these warnings: > | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target.c:4365:12: error: format specifies > | type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > | " %s\n", atomic_read(&sess->nconn) > > For all warnings, the format specifier is `%hu` which describes an > unsigned short. The resulting type of atomic_read is an int. The > proposed fix is to listen to Clang and swap the format specifier. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt <justinstitt@google.com> Thanks for the patch! Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > --- > diff from v1->v2: > Combined two similar patches into one: > * https://lore.kernel.org/all/20220708221314.466294-1-justinstitt@google.com/ > * https://lore.kernel.org/llvm/20220708211447.135209-1-justinstitt@google.com/ > > drivers/target/iscsi/iscsi_target.c | 2 +- > drivers/target/iscsi/iscsi_target_login.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c > index e368f038ff5c..bfb717065344 100644 > --- a/drivers/target/iscsi/iscsi_target.c > +++ b/drivers/target/iscsi/iscsi_target.c > @@ -4361,7 +4361,7 @@ int iscsit_close_connection( > > spin_lock_bh(&sess->conn_lock); > atomic_dec(&sess->nconn); > - pr_debug("Decremented iSCSI connection count to %hu from node:" > + pr_debug("Decremented iSCSI connection count to %d from node:" > " %s\n", atomic_read(&sess->nconn), > sess->sess_ops->InitiatorName); > /* > diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c > index 6b94eecc4790..0778591abae7 100644 > --- a/drivers/target/iscsi/iscsi_target_login.c > +++ b/drivers/target/iscsi/iscsi_target_login.c > @@ -715,7 +715,7 @@ void iscsi_post_login_handler( > > list_add_tail(&conn->conn_list, &sess->sess_conn_list); > atomic_inc(&sess->nconn); > - pr_debug("Incremented iSCSI Connection count to %hu" > + pr_debug("Incremented iSCSI Connection count to %d" > " from node: %s\n", atomic_read(&sess->nconn), > sess->sess_ops->InitiatorName); > spin_unlock_bh(&sess->conn_lock); > @@ -763,7 +763,7 @@ void iscsi_post_login_handler( > spin_lock_bh(&sess->conn_lock); > list_add_tail(&conn->conn_list, &sess->sess_conn_list); > atomic_inc(&sess->nconn); > - pr_debug("Incremented iSCSI Connection count to %hu from node:" > + pr_debug("Incremented iSCSI Connection count to %d from node:" > " %s\n", atomic_read(&sess->nconn), > sess->sess_ops->InitiatorName); > spin_unlock_bh(&sess->conn_lock); > -- > 2.37.0.170.g444d1eabd0-goog > -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] target: iscsi: fix clang -Wformat warnings 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt 2022-07-18 20:55 ` Nick Desaulniers @ 2022-07-18 21:35 ` Chaitanya Kulkarni 2022-07-19 3:00 ` Martin K. Petersen 2022-07-27 3:15 ` Martin K. Petersen 3 siblings, 0 replies; 7+ messages in thread From: Chaitanya Kulkarni @ 2022-07-18 21:35 UTC (permalink / raw) To: Justin Stitt Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, llvm@lists.linux.dev, martin.petersen@oracle.com, Max Gurtovoy, michael.christie@oracle.com, mingzhe.zou@easystack.cn, nathan@kernel.org, ndesaulniers@google.com, target-devel@vger.kernel.org, trix@redhat.com On 7/18/22 11:04, Justin Stitt wrote: > When building with Clang we encounter these warnings: > | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target.c:4365:12: error: format specifies > | type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > | " %s\n", atomic_read(&sess->nconn) > > For all warnings, the format specifier is `%hu` which describes an > unsigned short. The resulting type of atomic_read is an int. The > proposed fix is to listen to Clang and swap the format specifier. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt <justinstitt@google.com> Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] target: iscsi: fix clang -Wformat warnings 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt 2022-07-18 20:55 ` Nick Desaulniers 2022-07-18 21:35 ` Chaitanya Kulkarni @ 2022-07-19 3:00 ` Martin K. Petersen 2022-07-27 3:15 ` Martin K. Petersen 3 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2022-07-19 3:00 UTC (permalink / raw) To: Justin Stitt Cc: linux-kernel, linux-scsi, llvm, martin.petersen, mgurtovoy, michael.christie, mingzhe.zou, nathan, ndesaulniers, target-devel, trix Justin, > For all warnings, the format specifier is `%hu` which describes an > unsigned short. The resulting type of atomic_read is an int. The > proposed fix is to listen to Clang and swap the format specifier. Applied to 5.20/scsi-staging, thanks! -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] target: iscsi: fix clang -Wformat warnings 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt ` (2 preceding siblings ...) 2022-07-19 3:00 ` Martin K. Petersen @ 2022-07-27 3:15 ` Martin K. Petersen 3 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2022-07-27 3:15 UTC (permalink / raw) To: Justin Stitt Cc: Martin K . Petersen, nathan, trix, mingzhe.zou, linux-kernel, mgurtovoy, linux-scsi, ndesaulniers, target-devel, llvm, michael.christie On Mon, 18 Jul 2022 11:04:21 -0700, Justin Stitt wrote: > When building with Clang we encounter these warnings: > | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format > | specifies type 'unsigned short' but the argument has type 'int' > | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), > - > | drivers/target/iscsi/iscsi_target.c:4365:12: error: format specifies > | type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > | " %s\n", atomic_read(&sess->nconn) > > [...] Applied to 5.20/scsi-queue, thanks! [1/1] target: iscsi: fix clang -Wformat warnings https://git.kernel.org/mkp/scsi/c/71b25693b22e -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-07-27 3:16 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-07-08 21:14 [PATCH] target: iscsi: fix clang -Wformat warning Justin Stitt 2022-07-08 23:42 ` Nick Desaulniers 2022-07-18 18:04 ` [PATCH v2] target: iscsi: fix clang -Wformat warnings Justin Stitt 2022-07-18 20:55 ` Nick Desaulniers 2022-07-18 21:35 ` Chaitanya Kulkarni 2022-07-19 3:00 ` Martin K. Petersen 2022-07-27 3:15 ` Martin K. Petersen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox