Whamcloud - gitweb
e2fsck: add error checking for ext2fs_extent_get_info()
authorTheodore Ts'o <tytso@mit.edu>
Fri, 12 Feb 2021 04:47:32 +0000 (23:47 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 12 Feb 2021 04:47:32 +0000 (23:47 -0500)
This function can't actually fail today, but in the future it could
return an error, so it's better to add the appropriate error check.

Addresses-Coverity-Bug: #1464579
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c

index a1e24e5..9d43089 100644 (file)
@@ -3027,7 +3027,12 @@ report_problem:
                        if (extent.e_lblk != lblk) {
                                struct ext2_extent_info e_info;
 
-                               ext2fs_extent_get_info(ehandle, &e_info);
+                               pctx->errcode = ext2fs_extent_get_info(ehandle,
+                                                                      &e_info);
+                               if (pctx->errcode) {
+                                       pctx->str = "ext2fs_extent_get_info";
+                                       return;
+                               }
                                pctx->blk = lblk;
                                pctx->blk2 = extent.e_lblk;
                                pctx->num = e_info.curr_level - 1;