From: Disha Goel <disgoel@linux.ibm.com>
To: Andrea Cervesato <andrea.cervesato@suse.com>,
linuxtestproject.agent@gmail.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] memcg/memcontrol02: fix fd leak in cleanup path
Date: Tue, 18 Aug 2026 17:51:20 +0530 [thread overview]
Message-ID: <6fac2e93-7de5-48b1-b29e-9b2f1028f067@linux.ibm.com> (raw)
In-Reply-To: <6a799cc3.3b530373.1ff701.4966@mx.google.com>
On 10/08/26 3:11 pm, Andrea Cervesato wrote:
> Hi Disha,
>
>>> fd is initialized to 0 (a valid file descriptor) so the cleanup()
>>> guard 'if (fd > -1)' would never trigger.
>>
>> Could this explanation be corrected? Zero is greater than -1, and the
>> cleanup guard is added by this patch rather than being an existing guard.
>> The relevant problem is that -1 is needed to distinguish an unopened
>> descriptor before cleanup tries to close it.
>>
>>> + if (fd > -1)
>>> + SAFE_CLOSE(fd);
>>
>> Could this use `fd != -1` instead? LTP file descriptors use -1 as the
>> invalid sentinel, and the LTP convention requires this form for cleanup
>> guards.
>
> this is correct.
>
>>
>> --- [PATCH 2/2] ---
>>
>>> #include <inttypes.h>
>>>
>>> - tst_res(TINFO, "Child %d in %s: Allocating anon: %"PRIdPTR,
>>> + tst_res(TINFO, "Child %d in %s: Allocating anon: %zu",
>>
>> Could the now-unused `<inttypes.h>` include be removed from both
>> memcontrol03.c and memcontrol04.c? This patch replaces every `PRIdPTR`
>> use in both files.
>
> And also this is correct. We should split the patch in two: one for
> memcontrol03 and one for memcontrol04
>
Hi Andrea,
Thanks for the review. I've addressed all the comments and sent a v2.
Link to v2:
https://lore.kernel.org/ltp/20260818121436.1397-1-disgoel@linux.ibm.com/
> --
> Andrea Cervesato
> SUSE QE Automation Engineer Linux
> andrea.cervesato@suse.com
--
Regards,
Disha
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-18 12:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 13:05 [LTP] [PATCH 1/2] memcg/memcontrol02: fix fd leak in cleanup path Disha Goel
2026-08-07 13:05 ` [LTP] [PATCH 2/2] memcg/memcontrol03-04: fix typos, redundant define and format specifiers Disha Goel
2026-08-07 14:18 ` [LTP] memcg/memcontrol02: fix fd leak in cleanup path linuxtestproject.agent
2026-08-10 9:41 ` Andrea Cervesato via ltp
2026-08-18 12:21 ` Disha Goel [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-08-18 12:14 [LTP] [PATCH v2 1/3] " Disha Goel
2026-08-18 12:45 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fac2e93-7de5-48b1-b29e-9b2f1028f067@linux.ibm.com \
--to=disgoel@linux.ibm.com \
--cc=andrea.cervesato@suse.com \
--cc=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.