linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* inux-6.17/tools/perf/util/lzma.c:123: Strange return value ?
@ 2025-09-30 10:19 David Binderman
  2025-09-30 13:34 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2025-09-30 10:19 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Kan Liang, linux-perf-users@vger.kernel.org, LKML

Hello there,

Static analyser cppcheck says:

linux-6.17/tools/perf/util/lzma.c:123:3: style: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]

Source code is

bool lzma_is_compressed(const char *input)
{
    int fd = open(input, O_RDONLY);
    const uint8_t magic[6] = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
    char buf[6] = { 0 };
    ssize_t rc;

    if (fd < 0)
        return -1;

Suggest return either true or false.

Also, there is a duplicate of this problem at file linux-6.17/tools/perf/util/zlib.c
line 91.

Regards

David Binderman



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

* Re: inux-6.17/tools/perf/util/lzma.c:123: Strange return value ?
  2025-09-30 10:19 inux-6.17/tools/perf/util/lzma.c:123: Strange return value ? David Binderman
@ 2025-09-30 13:34 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2025-09-30 13:34 UTC (permalink / raw)
  To: David Binderman
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, Jiri Olsa, Adrian Hunter,
	Kan Liang, linux-perf-users@vger.kernel.org, LKML

On Tue, Sep 30, 2025 at 3:19 AM David Binderman <dcb314@hotmail.com> wrote:
>
> Hello there,
>
> Static analyser cppcheck says:
>
> linux-6.17/tools/perf/util/lzma.c:123:3: style: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
>
> Source code is
>
> bool lzma_is_compressed(const char *input)
> {
>     int fd = open(input, O_RDONLY);
>     const uint8_t magic[6] = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
>     char buf[6] = { 0 };
>     ssize_t rc;
>
>     if (fd < 0)
>         return -1;
>
> Suggest return either true or false.
>
> Also, there is a duplicate of this problem at file linux-6.17/tools/perf/util/zlib.c
> line 91.

Thanks, a fix was already committed to the next branch:
https://lore.kernel.org/lkml/20250822162506.316844-3-ysk@kzalloc.com/
and the fixes tags should mean it isn't long before it is backported
to the stable branches.

Ian

> Regards
>
> David Binderman
>
>

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

end of thread, other threads:[~2025-09-30 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 10:19 inux-6.17/tools/perf/util/lzma.c:123: Strange return value ? David Binderman
2025-09-30 13:34 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).