From patchwork Fri Jan 3 05:29:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 306429 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8639E2C0095 for ; Fri, 3 Jan 2014 16:30:22 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751129AbaACFaQ (ORCPT ); Fri, 3 Jan 2014 00:30:16 -0500 Received: from imap.thunk.org ([74.207.234.97]:45549 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbaACFaN (ORCPT ); Fri, 3 Jan 2014 00:30:13 -0500 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1VyxKm-00059s-Hq; Fri, 03 Jan 2014 05:30:12 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id A224A5801F1; Fri, 3 Jan 2014 00:30:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=thunk.org; s=mail; t=1388727006; bh=9JIVDEa971R6G/30baILSiqtzM3BOigFxjdOsqnZni0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIDzwEG2v22FJtzi+NwLgaq6urO9qLbk+TTkAD0Jq8k8S0F47QFbnxsSAtI/jdcZ3 j8u9dwVepVs5vPP7BzY3AeQG+HkOgWL2uGp69dKBCDCBQ2lwN9EFRu/rviwDkHPK0p iHzYyNSUERAdC7zHowsPvnpgUIXVbJAu6sY/Xwxc= From: Theodore Ts'o To: Ext4 Developers List Cc: Theodore Ts'o Subject: [PATCH 3/5] e2image: avoid potential divide by zero Date: Fri, 3 Jan 2014 00:29:56 -0500 Message-Id: <1388726998-14349-3-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.8.5.rc3.362.gdf10213 In-Reply-To: <1388726998-14349-1-git-send-email-tytso@mit.edu> References: <1388726998-14349-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org It's highly unlikely after five seconds that zero blocks would have been written, but let's silence the Coverity warning. Addresses-Coverity-ID: 1147780 Signed-off-by: "Theodore Ts'o" Reviewed-by: Eric Sandeen --- misc/e2image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/e2image.c b/misc/e2image.c index ac62ffe..6c51137 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -634,7 +634,7 @@ more_blocks: bscount = print_progress(total_written, meta_blocks_count); duration = time(NULL) - start_time; - if (duration > 5) { + if (duration > 5 && total_written) { time_t est = (duration * meta_blocks_count / total_written) - duration; char buff[30];