All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
@ 2025-08-28 10:46 Miaoqian Lin
  2025-10-11  3:48 ` Mi, Dapeng
  0 siblings, 1 reply; 6+ messages in thread
From: Miaoqian Lin @ 2025-08-28 10:46 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, linux-perf-users,
	linux-kernel
  Cc: linmq006, stable

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);
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
  2025-08-28 10:46 [PATCH] perf tools: Fix bool return value in gzip_is_compressed() Miaoqian Lin
@ 2025-10-11  3:48 ` Mi, Dapeng
  2025-10-13  9:16   ` Namhyung Kim
  2025-10-14 18:25   ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: Mi, Dapeng @ 2025-10-11  3:48 UTC (permalink / raw)
  To: Miaoqian Lin, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	Liang, Kan, linux-perf-users, linux-kernel
  Cc: stable


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>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
  2025-10-11  3:48 ` Mi, Dapeng
@ 2025-10-13  9:16   ` Namhyung Kim
  2025-10-13 10:27     ` Mi, Dapeng
  2025-10-14 18:25   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2025-10-13  9:16 UTC (permalink / raw)
  To: Mi, Dapeng
  Cc: Miaoqian Lin, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, Liang, Kan,
	linux-perf-users, linux-kernel, stable

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
  2025-10-13  9:16   ` Namhyung Kim
@ 2025-10-13 10:27     ` Mi, Dapeng
  0 siblings, 0 replies; 6+ messages in thread
From: Mi, Dapeng @ 2025-10-13 10:27 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Miaoqian Lin, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, Liang, Kan,
	linux-perf-users, linux-kernel, stable


On 10/13/2025 5:16 PM, Namhyung Kim wrote:
> 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").

Good to know this has been fixed. Thanks. :)


>
> Thanks,
> Namhyung
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
  2025-10-11  3:48 ` Mi, Dapeng
  2025-10-13  9:16   ` Namhyung Kim
@ 2025-10-14 18:25   ` Arnaldo Carvalho de Melo
  2025-10-14 18:34     ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-10-14 18:25 UTC (permalink / raw)
  To: Mi, Dapeng
  Cc: Miaoqian Lin, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Liang, Kan, linux-perf-users, linux-kernel, stable

On Sat, Oct 11, 2025 at 11:48:56AM +0800, Mi, Dapeng wrote:
> > +++ b/tools/perf/util/zlib.c
> > @@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)
> >  	if (fd < 0)
> > -		return -1;
> > +		return false;

> Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>

Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix bool return value in gzip_is_compressed()
  2025-10-14 18:25   ` Arnaldo Carvalho de Melo
@ 2025-10-14 18:34     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-10-14 18:34 UTC (permalink / raw)
  To: Mi, Dapeng
  Cc: Miaoqian Lin, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Liang, Kan, linux-perf-users, linux-kernel, stable

On Tue, Oct 14, 2025 at 03:25:46PM -0300, Arnaldo Carvalho de Melo wrote:
> On Sat, Oct 11, 2025 at 11:48:56AM +0800, Mi, Dapeng wrote:
> > > +++ b/tools/perf/util/zlib.c
> > > @@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)
> > >  	if (fd < 0)
> > > -		return -1;
> > > +		return false;
> 
> > Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
 
> Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Sorry for the noise, I merged this already, it is already in 6.18-rc1 :-\

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-14 18:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 10:46 [PATCH] perf tools: Fix bool return value in gzip_is_compressed() Miaoqian Lin
2025-10-11  3:48 ` Mi, Dapeng
2025-10-13  9:16   ` Namhyung Kim
2025-10-13 10:27     ` Mi, Dapeng
2025-10-14 18:25   ` Arnaldo Carvalho de Melo
2025-10-14 18:34     ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.