summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorShailesh Pandey <p.shailesh@samsung.com>2016-12-14 18:06:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-14 19:04:08 -0500
commit63980c80e1e99cb324942f3b5e59657025af47c0 (patch)
treecb159edf5137bfb5e542e64264a4e4de49602a69 /ipc
parent999898355e08ae3b92dfd0a08db706e0c6703d30 (diff)
ipc/shm.c: coding style fixes
This patch fixes below warnings: WARNING: Missing a blank line after declarations WARNING: Block comments use a trailing */ on a separate line ERROR: spaces required around that '=' (ctx:WxV) Above warnings were reported by checkpatch.pl Link: http://lkml.kernel.org/r/1478604980-18062-1-git-send-email-p.shailesh@samsung.com Signed-off-by: Shailesh Pandey <p.shailesh@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/shm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index dbac8860c721..81203e8ba013 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -89,6 +89,7 @@ void shm_init_ns(struct ipc_namespace *ns)
89static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) 89static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
90{ 90{
91 struct shmid_kernel *shp; 91 struct shmid_kernel *shp;
92
92 shp = container_of(ipcp, struct shmid_kernel, shm_perm); 93 shp = container_of(ipcp, struct shmid_kernel, shm_perm);
93 94
94 if (shp->shm_nattch) { 95 if (shp->shm_nattch) {
@@ -387,6 +388,7 @@ static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
387 struct file *file = vma->vm_file; 388 struct file *file = vma->vm_file;
388 struct shm_file_data *sfd = shm_file_data(file); 389 struct shm_file_data *sfd = shm_file_data(file);
389 int err = 0; 390 int err = 0;
391
390 if (sfd->vm_ops->set_policy) 392 if (sfd->vm_ops->set_policy)
391 err = sfd->vm_ops->set_policy(vma, new); 393 err = sfd->vm_ops->set_policy(vma, new);
392 return err; 394 return err;
@@ -417,7 +419,7 @@ static int shm_mmap(struct file *file, struct vm_area_struct *vma)
417 * In case of remap_file_pages() emulation, the file can represent 419 * In case of remap_file_pages() emulation, the file can represent
418 * removed IPC ID: propogate shm_lock() error to caller. 420 * removed IPC ID: propogate shm_lock() error to caller.
419 */ 421 */
420 ret =__shm_open(vma); 422 ret = __shm_open(vma);
421 if (ret) 423 if (ret)
422 return ret; 424 return ret;
423 425
@@ -468,6 +470,7 @@ static unsigned long shm_get_unmapped_area(struct file *file,
468 unsigned long flags) 470 unsigned long flags)
469{ 471{
470 struct shm_file_data *sfd = shm_file_data(file); 472 struct shm_file_data *sfd = shm_file_data(file);
473
471 return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len, 474 return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len,
472 pgoff, flags); 475 pgoff, flags);
473} 476}
@@ -766,6 +769,7 @@ static void shm_add_rss_swap(struct shmid_kernel *shp,
766 } else { 769 } else {
767#ifdef CONFIG_SHMEM 770#ifdef CONFIG_SHMEM
768 struct shmem_inode_info *info = SHMEM_I(inode); 771 struct shmem_inode_info *info = SHMEM_I(inode);
772
769 spin_lock_irq(&info->lock); 773 spin_lock_irq(&info->lock);
770 *rss_add += inode->i_mapping->nrpages; 774 *rss_add += inode->i_mapping->nrpages;
771 *swp_add += info->swapped; 775 *swp_add += info->swapped;
@@ -1028,6 +1032,7 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
1028 1032
1029 if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) { 1033 if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) {
1030 kuid_t euid = current_euid(); 1034 kuid_t euid = current_euid();
1035
1031 if (!uid_eq(euid, shp->shm_perm.uid) && 1036 if (!uid_eq(euid, shp->shm_perm.uid) &&
1032 !uid_eq(euid, shp->shm_perm.cuid)) { 1037 !uid_eq(euid, shp->shm_perm.cuid)) {
1033 err = -EPERM; 1038 err = -EPERM;
@@ -1045,6 +1050,7 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
1045 1050
1046 if (cmd == SHM_LOCK) { 1051 if (cmd == SHM_LOCK) {
1047 struct user_struct *user = current_user(); 1052 struct user_struct *user = current_user();
1053
1048 err = shmem_lock(shm_file, 1, user); 1054 err = shmem_lock(shm_file, 1, user);
1049 if (!err && !(shp->shm_perm.mode & SHM_LOCKED)) { 1055 if (!err && !(shp->shm_perm.mode & SHM_LOCKED)) {
1050 shp->shm_perm.mode |= SHM_LOCKED; 1056 shp->shm_perm.mode |= SHM_LOCKED;
@@ -1354,9 +1360,10 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
1354 vma = next; 1360 vma = next;
1355 } 1361 }
1356 1362
1357#else /* CONFIG_MMU */ 1363#else /* CONFIG_MMU */
1358 /* under NOMMU conditions, the exact address to be destroyed must be 1364 /* under NOMMU conditions, the exact address to be destroyed must be
1359 * given */ 1365 * given
1366 */
1360 if (vma && vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) { 1367 if (vma && vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) {
1361 do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); 1368 do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start);
1362 retval = 0; 1369 retval = 0;