In set_proc_kptr_restrict() we test whether fd > 0 to close it. Theorically, open() could have returned zero if stdin was closed. I don't think it could happen here, but changing the test with fd >= 0 silence the static analyser which complains about a ressource leak. Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx> --- lib/trace-cmd/trace-output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c index 7be175af..6a9606c7 100644 --- a/lib/trace-cmd/trace-output.c +++ b/lib/trace-cmd/trace-output.c @@ -1124,7 +1124,7 @@ static void set_proc_kptr_restrict(int reset) if (write(fd, &buf, 1) > 0) ret = 0; err: - if (fd > 0) + if (fd >= 0) close(fd); if (ret) tracecmd_warning("can't set kptr_restrict"); -- 2.44.0