anitazha / rpms / ndctl

Forked from rpms/ndctl a year ago
Clone

Blame SOURCES/0143-libcxl-Remove-extraneous-NULL-checks-when-validating.patch

e0018b
From 4b381a31345930d08ab9adb87087bb765f624506 Mon Sep 17 00:00:00 2001
e0018b
From: Alison Schofield <alison.schofield@intel.com>
e0018b
Date: Thu, 3 Mar 2022 15:16:57 -0800
e0018b
Subject: [PATCH 143/217] libcxl: Remove extraneous NULL checks when validating
e0018b
 cmd status
e0018b
e0018b
When a cxl_cmd_new_*() function is executed the returned command
e0018b
pointer is always checked for NULL. Remove extraneous NULL checks
e0018b
later in the command validation path.
e0018b
e0018b
Coverity pointed these out as 'check_after_deref' issues.
e0018b
e0018b
Link: https://lore.kernel.org/r/20220303231657.1053594-1-alison.schofield@intel.com
e0018b
Fixes: 4f588b964dcc ("libcxl: add GET_PARTITION_INFO mailbox command and accessors")
e0018b
Fixes: 50b9d77232d4 ("libcxl: add accessors for capacity fields of the IDENTIFY command")
e0018b
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 cxl/lib/libcxl.c | 4 ----
e0018b
 1 file changed, 4 deletions(-)
e0018b
e0018b
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
e0018b
index daa2bbc..f111d86 100644
e0018b
--- a/cxl/lib/libcxl.c
e0018b
+++ b/cxl/lib/libcxl.c
e0018b
@@ -2283,8 +2283,6 @@ cmd_to_identify(struct cxl_cmd *cmd)
e0018b
 	if (cxl_cmd_validate_status(cmd, CXL_MEM_COMMAND_ID_IDENTIFY))
e0018b
 		return NULL;
e0018b
 
e0018b
-	if (!cmd)
e0018b
-		return NULL;
e0018b
 	return cmd->output_payload;
e0018b
 }
e0018b
 
e0018b
@@ -2429,8 +2427,6 @@ cmd_to_get_partition(struct cxl_cmd *cmd)
e0018b
 	if (cxl_cmd_validate_status(cmd, CXL_MEM_COMMAND_ID_GET_PARTITION_INFO))
e0018b
 		return NULL;
e0018b
 
e0018b
-	if (!cmd)
e0018b
-		return NULL;
e0018b
 	return cmd->output_payload;
e0018b
 }
e0018b
 
e0018b
-- 
e0018b
2.27.0
e0018b