Now that FIT images are reference counted, we need to initialize the
count to 1, otherwise __fit_close will underflow it.

Reported-by: Claude Sonnet 4.5 <[email protected]>
Fixes: f3aadb274abe ("FIT: add support to cache opened fit images")
Signed-off-by: Ahmad Fatoum <[email protected]>
---
Issue was found by Claude while reviewing the previous patch
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/image-fit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/image-fit.c b/common/image-fit.c
index b5d0e2e5381f..26bd8e265b25 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1120,6 +1120,8 @@ static int fuzz_fit(const u8 *data, size_t size)
        handle.fit = data;
        handle.fit_alloc = NULL;
 
+       refcount_set(&handle.users, 1);
+
        ret = fit_do_open(&handle);
        if (ret)
                goto out;
-- 
2.47.3


Reply via email to