* [PATCH] scsi: fnic: Fix invalid comparison for error
@ 2026-08-07 9:18 Roman Demidov
2026-08-07 10:01 ` Karan Tilak Kumar (kartilak)
0 siblings, 1 reply; 2+ messages in thread
From: Roman Demidov @ 2026-08-07 9:18 UTC (permalink / raw)
To: Satish Kharat
Cc: Roman Demidov, Sesidhar Baddela, Karan Tilak Kumar,
James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, lvc-project
The current comparison err != ERR_ECMDUNKNOWN is useless because err < 0
and ERR_ECMDUNKNOWN == 5. The logic is that if the CMD_CAPABILITY
command was executed, there is no need to respond to unknown errors.
Therefore, the sign of the number in the comparison must be changed.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com>
---
drivers/scsi/fnic/vnic_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c
index 991c86eb5aff..0e5ae0540d85 100644
--- a/drivers/scsi/fnic/vnic_dev.c
+++ b/drivers/scsi/fnic/vnic_dev.c
@@ -381,7 +381,7 @@ static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
if (result->color == color) {
if (result->error) {
err = -(int) result->error;
- if (err != ERR_ECMDUNKNOWN ||
+ if (err != -ERR_ECMDUNKNOWN ||
cmd != CMD_CAPABILITY)
pr_err("%s:Error %d devcmd %d\n",
pci_name(vdev->pdev),
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] scsi: fnic: Fix invalid comparison for error
2026-08-07 9:18 [PATCH] scsi: fnic: Fix invalid comparison for error Roman Demidov
@ 2026-08-07 10:01 ` Karan Tilak Kumar (kartilak)
0 siblings, 0 replies; 2+ messages in thread
From: Karan Tilak Kumar (kartilak) @ 2026-08-07 10:01 UTC (permalink / raw)
To: Roman Demidov, Satish Kharat (satishkh)
Cc: Sesidhar Baddela (sebaddel),
James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, lvc-project
On Friday, August 7, 2026 2:49 PM, Roman Demidov <roman.demidov.nn@gmail.com> wrote:
>
> The current comparison err != ERR_ECMDUNKNOWN is useless because err < 0
> and ERR_ECMDUNKNOWN == 5. The logic is that if the CMD_CAPABILITY
> command was executed, there is no need to respond to unknown errors.
> Therefore, the sign of the number in the comparison must be changed.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com>
> ---
> drivers/scsi/fnic/vnic_dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c
> index 991c86eb5aff..0e5ae0540d85 100644
> --- a/drivers/scsi/fnic/vnic_dev.c
> +++ b/drivers/scsi/fnic/vnic_dev.c
> @@ -381,7 +381,7 @@ static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
> if (result->color == color) {
> if (result->error) {
> err = -(int) result->error;
> - if (err != ERR_ECMDUNKNOWN ||
> + if (err != -ERR_ECMDUNKNOWN ||
> cmd != CMD_CAPABILITY)
> pr_err("%s:Error %d devcmd %d\n",
> pci_name(vdev->pdev),
> --
> 2.53.0
>
>
Thanks for this change, Roman. It looks good.
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Regards,
Karan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-07 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-07 9:18 [PATCH] scsi: fnic: Fix invalid comparison for error Roman Demidov
2026-08-07 10:01 ` Karan Tilak Kumar (kartilak)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®