diff mbox

[5/8] tools/xenalyze: Fix check for error return value

Message ID 1456411743-17741-6-git-send-email-george.dunlap@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

George Dunlap Feb. 25, 2016, 2:49 p.m. UTC
fdopen returns NULL on failure, not a negative integer.

CID 1306863
CID 1306858

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
Strangely, coverity counted this as two bugs: one for comparing a
pointer with a negative integer, one for the comparison never possibly
being true (thus making the if condition dead code).

CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/xentrace/xenalyze.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ian Jackson Feb. 26, 2016, 12:29 p.m. UTC | #1
George Dunlap writes ("[PATCH 5/8] tools/xenalyze: Fix check for error return value"):
> fdopen returns NULL on failure, not a negative integer.
> 
> CID 1306863
> CID 1306858
> 
> Signed-off-by: George Dunlap <george.dunlap@citrix.com>
> ---
> Strangely, coverity counted this as two bugs: one for comparing a
> pointer with a negative integer, one for the comparison never possibly
> being true (thus making the if condition dead code).

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Konrad Rzeszutek Wilk Feb. 29, 2016, 4:16 p.m. UTC | #2
On Fri, Feb 26, 2016 at 12:29:02PM +0000, Ian Jackson wrote:
> George Dunlap writes ("[PATCH 5/8] tools/xenalyze: Fix check for error return value"):
> > fdopen returns NULL on failure, not a negative integer.
> > 
> > CID 1306863
> > CID 1306858
> > 
> > Signed-off-by: George Dunlap <george.dunlap@citrix.com>
> > ---
> > Strangely, coverity counted this as two bugs: one for comparing a
> > pointer with a negative integer, one for the comparison never possibly
> > being true (thus making the if condition dead code).
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

applied
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 123030a..249bebd 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -9029,7 +9029,7 @@  void progress_init(void) {
         opt.progress = 0;
     }
 
-    if( (G.progress.out = fdopen(G.progress.pipe[1], "w")) < 0 ) {
+    if( (G.progress.out = fdopen(G.progress.pipe[1], "w")) == NULL ) {
         fprintf(stderr, "%s: could not fdopen pipe: %s, disabling progress bar\n",
                 __func__, strerror(errno));
         opt.progress = 0;