Procházet zdrojové kódy

perf_counter tools: Fix strbuf_fread() error path handling

size_t res cannot be less than 0 - fread returns 0 on error.

[ Updated by: René Scharfe <rene.scharfe@lsrfire.ath.cx> ]

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>
LKML-Reference: <4A3FB479.2090902@lsrfire.ath.cx>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Roel Kluin před 16 roky
rodič
revize
f7679dabfa
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      tools/perf/util/strbuf.c

+ 1 - 1
tools/perf/util/strbuf.c

@@ -259,7 +259,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
 	res = fread(sb->buf + sb->len, 1, size, f);
 	if (res > 0)
 		strbuf_setlen(sb, sb->len + res);
-	else if (res < 0 && oldalloc == 0)
+	else if (oldalloc == 0)
 		strbuf_release(sb);
 	return res;
 }