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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Jul 2015 10:22:44 +0200
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	Hannes Reinecke <hare@...e.de>,
	"James E. J. Bottomley" <JBottomley@...allels.com>,
	linux-scsi@...r.kernel.org
Cc:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH] SCSI-aic7...: Delete unnecessary checks before the
 function call "kfree"

Am 05.02.2015 um 22:27 schrieb SF Markus Elfring:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Thu, 5 Feb 2015 22:23:48 +0100
> 
> The kfree() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/scsi/aic7xxx/aic7xxx_core.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
> index 10172a3..98a5ed1 100644
> --- a/drivers/scsi/aic7xxx/aic7xxx_core.c
> +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
> @@ -2200,8 +2200,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel, int force)
>  	if (channel == 'B')
>  		scsi_id += 8;
>  	tstate = ahc->enabled_targets[scsi_id];
> -	if (tstate != NULL)
> -		kfree(tstate);
> +	kfree(tstate);
>  	ahc->enabled_targets[scsi_id] = NULL;
>  }
>  #endif
> @@ -4482,8 +4481,7 @@ ahc_set_unit(struct ahc_softc *ahc, int unit)
>  void
>  ahc_set_name(struct ahc_softc *ahc, char *name)
>  {
> -	if (ahc->name != NULL)
> -		kfree(ahc->name);
> +	kfree(ahc->name);
>  	ahc->name = name;
>  }
>  
> @@ -4550,10 +4548,8 @@ ahc_free(struct ahc_softc *ahc)
>  		kfree(ahc->black_hole);
>  	}
>  #endif
> -	if (ahc->name != NULL)
> -		kfree(ahc->name);
> -	if (ahc->seep_config != NULL)
> -		kfree(ahc->seep_config);
> +	kfree(ahc->name);
> +	kfree(ahc->seep_config);
>  #ifndef __FreeBSD__
>  	kfree(ahc);
>  #endif
> @@ -4958,8 +4954,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
>  	case 0:
>  		break;
>  	}
> -	if (scb_data->scbarray != NULL)
> -		kfree(scb_data->scbarray);
> +	kfree(scb_data->scbarray);
>  }
>  
>  static void
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ