NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
* [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw()
@ 2023-07-31 20:18 Vishal Verma
  2023-07-31 20:28 ` Dave Jiang
  2023-07-31 20:40 ` Verma, Vishal L
  0 siblings, 2 replies; 3+ messages in thread
From: Vishal Verma @ 2023-07-31 20:18 UTC (permalink / raw)
  To: nvdimm, linux-cxl; +Cc: Vishal Verma

Static analysis complains that in some cases, an uninitialized 'rc' can
get returned from action_update_fw(). Since this can only happen in a
'no-op' case, initialize rc to 0.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 cxl/memdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cxl/memdev.c b/cxl/memdev.c
index 1ad871a..f6a2d3f 100644
--- a/cxl/memdev.c
+++ b/cxl/memdev.c
@@ -679,7 +679,7 @@ static int action_update_fw(struct cxl_memdev *memdev,
 	const char *devname = cxl_memdev_get_devname(memdev);
 	struct json_object *jmemdev;
 	unsigned long flags;
-	int rc;
+	int rc = 0;
 
 	if (param.cancel)
 		return cxl_memdev_cancel_fw_update(memdev);

---
base-commit: 32cec0c5cfe669940107ce030beeb1e02e5a767b
change-id: 20230731-coverity-fix-edc28fd6e0fe

Best regards,
-- 
Vishal Verma <vishal.l.verma@intel.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw()
  2023-07-31 20:18 [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw() Vishal Verma
@ 2023-07-31 20:28 ` Dave Jiang
  2023-07-31 20:40 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2023-07-31 20:28 UTC (permalink / raw)
  To: Vishal Verma, nvdimm, linux-cxl



On 7/31/23 13:18, Vishal Verma wrote:
> Static analysis complains that in some cases, an uninitialized 'rc' can
> get returned from action_update_fw(). Since this can only happen in a
> 'no-op' case, initialize rc to 0.
> 
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   cxl/memdev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cxl/memdev.c b/cxl/memdev.c
> index 1ad871a..f6a2d3f 100644
> --- a/cxl/memdev.c
> +++ b/cxl/memdev.c
> @@ -679,7 +679,7 @@ static int action_update_fw(struct cxl_memdev *memdev,
>   	const char *devname = cxl_memdev_get_devname(memdev);
>   	struct json_object *jmemdev;
>   	unsigned long flags;
> -	int rc;
> +	int rc = 0;
>   
>   	if (param.cancel)
>   		return cxl_memdev_cancel_fw_update(memdev);
> 
> ---
> base-commit: 32cec0c5cfe669940107ce030beeb1e02e5a767b
> change-id: 20230731-coverity-fix-edc28fd6e0fe
> 
> Best regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw()
  2023-07-31 20:18 [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw() Vishal Verma
  2023-07-31 20:28 ` Dave Jiang
@ 2023-07-31 20:40 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Verma, Vishal L @ 2023-07-31 20:40 UTC (permalink / raw)
  To: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev

On Mon, 2023-07-31 at 14:18 -0600, Vishal Verma wrote:
> Static analysis complains that in some cases, an uninitialized 'rc' can
> get returned from action_update_fw(). Since this can only happen in a
> 'no-op' case, initialize rc to 0.
> 
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

This should've included a

  Fixes: 64ad46b4a147 ("cxl: add an update-firmware command")

tag. I'll add it when applying.

> ---
>  cxl/memdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cxl/memdev.c b/cxl/memdev.c
> index 1ad871a..f6a2d3f 100644
> --- a/cxl/memdev.c
> +++ b/cxl/memdev.c
> @@ -679,7 +679,7 @@ static int action_update_fw(struct cxl_memdev *memdev,
>         const char *devname = cxl_memdev_get_devname(memdev);
>         struct json_object *jmemdev;
>         unsigned long flags;
> -       int rc;
> +       int rc = 0;
>  
>         if (param.cancel)
>                 return cxl_memdev_cancel_fw_update(memdev);
> 
> ---
> base-commit: 32cec0c5cfe669940107ce030beeb1e02e5a767b
> change-id: 20230731-coverity-fix-edc28fd6e0fe
> 
> Best regards,


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-31 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 20:18 [PATCH ndctl] cxl/memdev: initialize 'rc' in action_update_fw() Vishal Verma
2023-07-31 20:28 ` Dave Jiang
2023-07-31 20:40 ` Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox