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, 03 Jan 2014 10:40:25 -0600
From:	Eric Sandeen <sandeen@...hat.com>
To:	"Theodore Ts'o" <tytso@....edu>,
	Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 2/5] e2image: eliminate division by zero

On 1/2/14, 11:29 PM, Theodore Ts'o wrote:
> Dividing a floating point number by zero is undefined in C.  It
> happens to work with gcc/glibc, but it's not something that's
> guaranteed.
> 
> Addresses-Coverity-ID: #1147781
> 
> Signed-off-by: "Theodore Ts'o" <tytso@....edu>

Reviewed-by: Eric Sandeen <sandeen@...hat.com>


> ---
>  misc/e2image.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/misc/e2image.c b/misc/e2image.c
> index 253fad1..ac62ffe 100644
> --- a/misc/e2image.c
> +++ b/misc/e2image.c
> @@ -704,14 +704,15 @@ more_blocks:
>  	if (show_progress) {
>  		time_t duration = time(NULL) - start_time;
>  		char buff[30];
> -		while (bscount--)
> -			fputc('\b', stderr);
> +		fputc('\r', stderr);
>  		strftime(buff, 30, "%T", gmtime(&duration));
> -		fprintf(stderr, _("\b\b\b\b\b\b\b\bCopied %llu / %llu "
> -			 "blocks (%d%%) in %s at %.2f MB/s       \n"),
> -		       total_written, meta_blocks_count,
> -		       calc_percent(total_written, meta_blocks_count), buff,
> -		       calc_rate(total_written, fs->blocksize, duration));
> +		fprintf(stderr, _("Copied %llu / %llu blocks (%d%%) in %s "),
> +			total_written, meta_blocks_count,
> +			calc_percent(total_written, meta_blocks_count), buff);
> +		if (duration)
> +			fprintf(stderr, _("at %.2f MB/s"),
> +				calc_rate(total_written, fs->blocksize, duration));
> +		fputs("       \n", stderr);
>  	}
>  #ifdef HAVE_FTRUNCATE64
>  	if (sparse) {
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ