2023-11-28 11:20:04

by Artem Chernyshev

[permalink] [raw]
Subject: [PATCH] scsi: fnic: return error if vmalloc failed

In fnic_init_module() exists redundant check for return value
from fnic_debugfs_init(), because at moment it only can
return zero. It make sense to process theoretical vmalloc failure.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 9730ddfb123d ("scsi: fnic: remove redundant assignment of variable rc")
Signed-off-by: Artem Chernyshev <[email protected]>
---
drivers/scsi/fnic/fnic_debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index c4d9ed0d7d75..cf2601bf170a 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -52,9 +52,10 @@ int fnic_debugfs_init(void)
fc_trc_flag->fnic_trace = 2;
fc_trc_flag->fc_trace = 3;
fc_trc_flag->fc_clear = 4;
+ return 0;
}

- return 0;
+ return -ENOMEM;
}

/*
--
2.37.3


Subject: RE: [PATCH] scsi: fnic: return error if vmalloc failed

On Tuesday, November 28, 2023 3:10 AM, Artem Chernyshev <[email protected]> wrote:
>
> In fnic_init_module() exists redundant check for return value from fnic_debugfs_init(), because at moment it only can return zero. It make sense to process theoretical vmalloc failure.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 9730ddfb123d ("scsi: fnic: remove redundant assignment of variable rc")
> Signed-off-by: Artem Chernyshev <[email protected]>
> ---
> drivers/scsi/fnic/fnic_debugfs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
> index c4d9ed0d7d75..cf2601bf170a 100644
> --- a/drivers/scsi/fnic/fnic_debugfs.c
> +++ b/drivers/scsi/fnic/fnic_debugfs.c
> @@ -52,9 +52,10 @@ int fnic_debugfs_init(void)
> fc_trc_flag->fnic_trace = 2;
> fc_trc_flag->fc_trace = 3;
> fc_trc_flag->fc_clear = 4;
> + return 0;
> }
>
> - return 0;
> + return -ENOMEM;
> }
>
> /*
> --
> 2.37.3

Looks good to me.
Reviewed-by: Karan Tilak Kumar <[email protected]>

Regards,
Karan

2023-12-06 01:48:48

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: fnic: return error if vmalloc failed


Artem,

> In fnic_init_module() exists redundant check for return value from
> fnic_debugfs_init(), because at moment it only can return zero. It
> make sense to process theoretical vmalloc failure.

Applied to 6.8/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2023-12-14 04:29:48

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: fnic: return error if vmalloc failed

On Tue, 28 Nov 2023 14:10:08 +0300, Artem Chernyshev wrote:

> In fnic_init_module() exists redundant check for return value
> from fnic_debugfs_init(), because at moment it only can
> return zero. It make sense to process theoretical vmalloc failure.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
>
> [...]

Applied to 6.8/scsi-queue, thanks!

[1/1] scsi: fnic: return error if vmalloc failed
https://git.kernel.org/mkp/scsi/c/f5f27a332a14

--
Martin K. Petersen Oracle Linux Engineering