block: Ensure srcpath backing loop image mount point is not null 18/274418/1
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 27 Apr 2022 15:54:45 +0000 (17:54 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 28 Apr 2022 05:21:30 +0000 (05:21 +0000)
This commit addresses SVACE-reported issue.

Change-Id: I03871ae2cda6c5aede9582dc4be62aeb31696b4b
(cherry picked from commit ce0dfa31d883a26d060b60fcba36c972b5bbf739)

src/block/block.c

index 5e51bab7bcb03b0b0ae459d63fb25c37f0c8e295..bdf6e78164b3053000f9fa2b988defdb6f5e7c4a 100644 (file)
@@ -2574,9 +2574,13 @@ static int get_internal_storage_number(void)
                                fs = mnt_table_find_target(t, p, MNT_ITER_BACKWARD);
                                if (!fs)
                                        continue;
-                               const char *origtemp = temp;
-                               temp = mnt_fs_get_srcpath(fs);
-                               _I("%s is found under mountpoint %s on device %s (internal storage candidate)\n", origtemp, p, temp);
+
+                               const char *loopmnt_srcpath = mnt_fs_get_srcpath(fs);
+                               if (!loopmnt_srcpath)
+                                       continue;
+
+                               _I("%s is found under mountpoint %s on device %s (internal storage candidate)\n", temp, p, loopmnt_srcpath);
+                               temp = loopmnt_srcpath;
                                break;
                        }
                        free(backingfile_path);