[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmXCB7VoQLXfBgfyxdMvqaNeacMVbkCFptAqzX21KuPtg@mail.gmail.com>
Date: Fri, 8 Jul 2022 16:42:25 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Justin Stitt <justinstitt@...gle.com>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
Nathan Chancellor <nathan@...nel.org>,
Tom Rix <trix@...hat.com>,
Mike Christie <michael.christie@...cle.com>,
Max Gurtovoy <mgurtovoy@...dia.com>,
Mingzhe Zou <mingzhe.zou@...ystack.cn>,
linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] target: iscsi: fix clang -Wformat warning
On Fri, Jul 8, 2022 at 2:15 PM Justin Stitt <justinstitt@...gle.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@...gle.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
Powered by blists - more mailing lists