anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

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

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