Re: [PATCH] tests/sw_sync: fix invalid fd test
Kamil Konieczny <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi Luka, On 2026-08-10 at 19:00:19 +0200, Luka Mamrikishvili wrote: > The invalid file fd test overwrites the file descriptor returned by > mkstemp() with a DRM device file descriptor. As a result, it tests a > device fd twice instead of testing a regular file fd, and leaks both > the first device fd and temporary file fd. > > Close the device fd after its test and retain the temporary file fd > for the file fd test. > > Signed-off-by: Luka Mamrikishvili <[email protected]> > --- > tests/sw_sync.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/sw_sync.c b/tests/sw_sync.c > index 8012652d6..a75ec044b 100644 > --- a/tests/sw_sync.c > +++ b/tests/sw_sync.c > @@ -334,6 +334,7 @@ static void test_sync_merge_invalid(void) > fence_invalid = drm_open_driver(DRIVER_ANY); > fence_merge = sync_fence_merge(in_fence, fence_invalid); > igt_assert_f(fence_merge < 0, "Verify invalid fd (device fd) handling"); > + close(fence_invalid); > > fence_invalid = mkstemp(tmppath); > if (fence_invalid == -1) { > @@ -341,7 +342,6 @@ static void test_sync_merge_invalid(void) > goto out; > } > unlink(tmppath); > - fence_invalid = drm_open_driver(DRIVER_ANY); > fence_merge = sync_fence_merge(in_fence, fence_invalid); > close(fence_invalid); > igt_assert_f(fence_merge < 0, "Verify invalid fd (file fd) handling"); LGTM Reviewed-by: Kamil Konieczny <[email protected]> Regards, Kamil > -- > 2.55.0 >