btrfs-progs: Use long type to get thread's return value
authorZhao Lei <zhaolei@cn.fujitsu.com>
Wed, 2 Sep 2015 12:22:30 +0000 (20:22 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 2 Sep 2015 16:56:54 +0000 (18:56 +0200)
pthread use void * to save return status, we can use this pointer to
save our return value, but we need to keep the same length.

This patch move to use long type variable to save return value
of our thread, to avoid potential invalid memory access.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
chunk-recover.c

index 3f67432..576a2a6 100644 (file)
@@ -831,7 +831,7 @@ static int scan_devices(struct recover_control *rc)
        struct btrfs_device *dev;
        struct device_scan *dev_scans;
        pthread_t *t_scans;
-       int *t_rets;
+       long *t_rets;
        int devnr = 0;
        int devidx = 0;
        int cancel_from = 0;
@@ -847,7 +847,7 @@ static int scan_devices(struct recover_control *rc)
        t_scans = (pthread_t *)malloc(sizeof(pthread_t) * devnr);
        if (!t_scans)
                return -ENOMEM;
-       t_rets = (int *)malloc(sizeof(int) * devnr);
+       t_rets = (long *)malloc(sizeof(long) * devnr);
        if (!t_rets)
                return -ENOMEM;