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:	Fri, 21 Dec 2012 23:03:15 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	Sasha Levin <sasha.levin@...cle.com>
cc:	Pekka Enberg <penberg@...nel.org>,
	Sasha Levin <levinsasha928@...il.com>,
	Asias He <asias.hejun@...il.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kvm tools: remove unneeded checks in qcow code

On Thu, 20 Dec 2012, Sasha Levin wrote:

> We already know q!=NULL at that point, no need to retest.
> 
Right, and even if it was ==NULL then 'free(NULL)' is guaranteed to be a 
NOP, so it would still be fine.

Reviewed-by: Jesper Juhl <jj@...osbits.net>


> Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
> ---
>  tools/kvm/disk/qcow.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c
> index ee2992e..64a2550 100644
> --- a/tools/kvm/disk/qcow.c
> +++ b/tools/kvm/disk/qcow.c
> @@ -1361,8 +1361,7 @@ free_header:
>  	if (q->header)
>  		free(q->header);
>  free_qcow:
> -	if (q)
> -		free(q);
> +	free(q);
>  
>  	return NULL;
>  }
> @@ -1492,8 +1491,7 @@ free_header:
>  	if (q->header)
>  		free(q->header);
>  free_qcow:
> -	if (q)
> -		free(q);
> +	free(q);
>  
>  	return NULL;
>  }
> 

-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
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