Commit 2f886ca1 authored by Michael Holzheu's avatar Michael Holzheu Committed by Pavel Emelyanov

criu/mount: Fix flags cast and sizeof(sflags)

The "args" parameter in apply_sb_flags() is unsigned long. Therefore also
use unsigned long for the cast.

The "sflags" variable in do_new_mount() is unsigned long. Therefore use
sizeof(sflags) instead of sizeof(int).
Signed-off-by: 's avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 3ed5c2f0
...@@ -1773,8 +1773,8 @@ static char *mnt_fsname(struct mount_info *mi) ...@@ -1773,8 +1773,8 @@ static char *mnt_fsname(struct mount_info *mi)
static int apply_sb_flags(void *args, int fd, pid_t pid) static int apply_sb_flags(void *args, int fd, pid_t pid)
{ {
unsigned long flags = *(unsigned long *) args;
int rst = -1, err = -1; int rst = -1, err = -1;
long flags = *(int *) args;
char path[PSFDS]; char path[PSFDS];
snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
...@@ -1839,10 +1839,9 @@ static int do_new_mount(struct mount_info *mi) ...@@ -1839,10 +1839,9 @@ static int do_new_mount(struct mount_info *mi)
pr_perror("Unable to open %s", mi->mountpoint); pr_perror("Unable to open %s", mi->mountpoint);
return -1; return -1;
} }
sflags |= MS_RDONLY; sflags |= MS_RDONLY;
if (userns_call(apply_sb_flags, 0, if (userns_call(apply_sb_flags, 0,
&sflags, sizeof(int), fd)) { &sflags, sizeof(sflags), fd)) {
pr_perror("Unable to apply mount falgs %d for %s", pr_perror("Unable to apply mount falgs %d for %s",
mi->sb_flags, mi->mountpoint); mi->sb_flags, mi->mountpoint);
close(fd); close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment