From e5b299064df997dc6659659db345486e0c38aadc Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 23 Mar 2023 02:49:43 +0000 Subject: [PATCH] AOSP: ext2simg: fix error check of io_channel_read_blk64() Check the return value of io_channel_read_blk64() correctly, considering that it returns an errcode_t, which can be positive. Fixes: db6f320912cf ("AOSP: android: add the ext2simg tool") Change-Id: Iafc6c0169bc8ac79198f285da0246ff3b841ded8 Signed-off-by: Eric Biggers From AOSP commit: 60634ff32a0d8c0d7942c6e522a74a5051d4b6e9 --- contrib/android/ext2simg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/android/ext2simg.c b/contrib/android/ext2simg.c index 13a9d567..d1b5dc4e 100644 --- a/contrib/android/ext2simg.c +++ b/contrib/android/ext2simg.c @@ -88,7 +88,7 @@ static void add_chunk(ext2_filsys fs, struct sparse_file *s, bi->next = buf_list; buf_list = bi; retval = io_channel_read_blk64(fs->io, chunk_start, num_blks, bi->buf); - if (retval < 0) + if (retval) ext2fs_fatal(retval, "reading data from %s", params.in_file); if (sparse_file_add_data(s, bi->buf, len, chunk_start) < 0) -- 2.47.2