summaryrefslogtreecommitdiff
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-11 21:19:04 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 17:02:57 +0300
commitc9c554f21490bbc96cc554f80024d27d09670480 (patch)
treef680bcb2253cf658a7a925d0eb20f2dff71c1f1f /ipc/shm.c
parent6b4e8085c0004382b985a5c005c685073630e746 (diff)
downloadlinux-c9c554f21490bbc96cc554f80024d27d09670480.tar.xz
alloc_file(): switch to passing O_... flags instead of FMODE_... mode
... so that it could set both ->f_flags and ->f_mode, without callers having to set ->f_flags manually. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 051a3e1fb8df..c702abd578a7 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1362,7 +1362,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg,
struct ipc_namespace *ns;
struct shm_file_data *sfd;
struct path path;
- fmode_t f_mode;
+ int f_flags;
unsigned long populate = 0;
err = -EINVAL;
@@ -1395,11 +1395,11 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg,
if (shmflg & SHM_RDONLY) {
prot = PROT_READ;
acc_mode = S_IRUGO;
- f_mode = FMODE_READ;
+ f_flags = O_RDONLY;
} else {
prot = PROT_READ | PROT_WRITE;
acc_mode = S_IRUGO | S_IWUGO;
- f_mode = FMODE_READ | FMODE_WRITE;
+ f_flags = O_RDWR;
}
if (shmflg & SHM_EXEC) {
prot |= PROT_EXEC;
@@ -1449,7 +1449,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg,
goto out_nattch;
}
- file = alloc_file(&path, f_mode,
+ file = alloc_file(&path, f_flags,
is_file_hugepages(shp->shm_file) ?
&shm_file_operations_huge :
&shm_file_operations);