lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat, 18 Apr 2020 17:59:39 +0800
From:   Jason Yan <yanaijie@...wei.com>
To:     <hare@...e.com>, <jejb@...ux.ibm.com>,
        <martin.petersen@...cle.com>, <yanaijie@...wei.com>,
        <alex.dewar@....co.uk>, <linux-scsi@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     Hulk Robot <hulkci@...wei.com>
Subject: [PATCH] scsi: aic7xxx: aic97xx: remove NULL check before some freeing functions

Fix the following coccicheck warning:

drivers/scsi/aic7xxx/aic79xx_core.c:6186:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic79xx_core.c:6188:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic79xx_core.c:6190:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic79xx_core.c:3666:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic79xx_core.c:6124:2-7: WARNING: NULL check before
some freeing functions is not needed.

Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Jason Yan <yanaijie@...wei.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index a336a458c978..72eaad4aef9c 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -3662,8 +3662,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force)
 		return;
 
 	tstate = ahd->enabled_targets[scsi_id];
-	if (tstate != NULL)
-		kfree(tstate);
+	kfree(tstate);
 	ahd->enabled_targets[scsi_id] = NULL;
 }
 #endif
@@ -6120,8 +6119,7 @@ ahd_set_unit(struct ahd_softc *ahd, int unit)
 void
 ahd_set_name(struct ahd_softc *ahd, char *name)
 {
-	if (ahd->name != NULL)
-		kfree(ahd->name);
+	kfree(ahd->name);
 	ahd->name = name;
 }
 
@@ -6182,12 +6180,9 @@ ahd_free(struct ahd_softc *ahd)
 		kfree(ahd->black_hole);
 	}
 #endif
-	if (ahd->name != NULL)
-		kfree(ahd->name);
-	if (ahd->seep_config != NULL)
-		kfree(ahd->seep_config);
-	if (ahd->saved_stack != NULL)
-		kfree(ahd->saved_stack);
+	kfree(ahd->name);
+	kfree(ahd->seep_config);
+	kfree(ahd->saved_stack);
 	kfree(ahd);
 	return;
 }
-- 
2.21.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ