inux-6.17/tools/perf/util/lzma.c:123: Strange return value ?

From: David Binderman

Date: Tue Sep 30 2025 - 06:19:22 EST


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