[3/3] mount: Do not set key to anything for auto-ext-mounts

Submitted by Pavel Emelianov on Sept. 21, 2016, 9:59 a.m.

Details

Message ID 57E25A08.8040005@virtuozzo.com
State Accepted
Series "Sanitize ext-mount-map usage in mount.c"
Commit 0bd022fa1e4c774fe1cad27f635e2dbfd9b65fa3
Headers show

Commit Message

Pavel Emelianov Sept. 21, 2016, 9:59 a.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/mount.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index 40e871b..273c624 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -83,13 +83,17 @@  static struct ext_mount *ext_mount_lookup(char *key)
 	return NULL;
 }
 
-static struct ext_mount *ext_mount_make_auto(char *key, char *val)
+static struct ext_mount *ext_mount_make_auto(char *val)
 {
 	struct ext_mount *em;
 
 	em = xmalloc(sizeof(*em));
 	if (em) {
-		em->key = key;
+		/*
+		 * The key is (should) only be used for lookup by
+		 * ext_mount_lookup() above.
+		 */
+		em->key = (char *)0x00BEDA00;
 		em->val = val;
 	}
 
@@ -877,7 +881,7 @@  static int resolve_external_mounts(struct mount_info *info)
 		if (!p)
 			return -1;
 
-		m->external = ext_mount_make_auto(p, AUTODETECTED_MOUNT);
+		m->external = ext_mount_make_auto(AUTODETECTED_MOUNT);
 		if (!m->external) {
 			free(p);
 			return -1;
@@ -3106,7 +3110,7 @@  static int get_mp_root(MntEntry *me, struct mount_info *mi)
 		 * dump by resolve_external_mounts().
 		 */
 
-		em = ext_mount_make_auto(AUTODETECTED_MOUNT, mi->source);
+		em = ext_mount_make_auto(mi->source);
 		if (!em)
 			return -1;
 	}