Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()

Namhyung Kim
2025-10-13T09:17:01Z

Hello,

On Sat, Oct 11, 2025 at 11:48:56AM +0800, Mi, Dapeng wrote:
>
> On 8/28/2025 6:46 PM, Miaoqian Lin wrote:
> > gzip_is_compressed() returns -1 on error but is declared as bool.
> > And -1 gets converted to true, which could be misleading.
> > Return false instead to match the declared type.
> >
> > Fixes: 88c74dc76a30 ("perf tools: Add gzip_is_compressed function")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> > ---
> > tools/perf/util/zlib.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/zlib.c b/tools/perf/util/zlib.c
> > index 78d2297c1b67..1f7c06523059 100644
> > --- a/tools/perf/util/zlib.c
> > +++ b/tools/perf/util/zlib.c
> > @@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)
> > ssize_t rc;
> >
> > if (fd < 0)
> > - return -1;
> > + return false;
> >
> > rc = read(fd, buf, sizeof(buf));
> > close(fd);
>
> Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>

We have 43fa1141e2c1af79 ("perf util: Fix compression checks returning -1
as bool").

Thanks,
Namhyung