From: michael.christie@oracle.com
To: Qianfeng Rong <rongqianfeng@vivo.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: target: iscsi: Use int type to store negative value
Date: Thu, 4 Sep 2025 10:12:12 -0500 [thread overview]
Message-ID: <c487f4b9-10f1-44c4-955e-c64fcc0b25d2@oracle.com> (raw)
In-Reply-To: <20250902125017.41371-1-rongqianfeng@vivo.com>
On 9/2/25 7:50 AM, Qianfeng Rong wrote:
> Change the 'ret' variable in iscsit_tmr_task_reassign() from u64 to int,
> as it needs to store either negative value or zero returned by
> iscsit_find_cmd_for_recovery().
>
> Storing the negative error codes in unsigned type, or performing equality
> comparisons (e.g., ret == -2), doesn't cause an issue at runtime [1] but
> can be confusing. Additionally, assigning negative error codes to unsigned
> type may trigger a GCC warning when the -Wsign-conversion flag is enabled.
>
> No effect on runtime.
>
> Link: https://lore.kernel.org/all/x3wogjf6vgpkisdhg3abzrx7v7zktmdnfmqeih5kosszmagqfs@oh3qxrgzkikf/ #1
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> drivers/target/iscsi/iscsi_target_tmr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c
> index f60b156ede12..620de3910599 100644
> --- a/drivers/target/iscsi/iscsi_target_tmr.c
> +++ b/drivers/target/iscsi/iscsi_target_tmr.c
> @@ -112,7 +112,8 @@ u8 iscsit_tmr_task_reassign(
> struct iscsi_tmr_req *tmr_req = cmd->tmr_req;
> struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req;
> struct iscsi_tm *hdr = (struct iscsi_tm *) buf;
> - u64 ret, ref_lun;
> + u64 ref_lun;
> + int ret;
>
> pr_debug("Got TASK_REASSIGN TMR ITT: 0x%08x,"
> " RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n",
Reviewed-by: Mike Christie <michael.christie@oracle.com>
next prev parent reply other threads:[~2025-09-04 15:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 12:50 [PATCH] scsi: target: iscsi: Use int type to store negative value Qianfeng Rong
2025-09-04 15:12 ` michael.christie [this message]
2025-09-10 2:04 ` Martin K. Petersen
2025-09-17 2:27 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c487f4b9-10f1-44c4-955e-c64fcc0b25d2@oracle.com \
--to=michael.christie@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=rongqianfeng@vivo.com \
--cc=target-devel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).