diff options
Diffstat (limited to 'ipc/shm.c')
| -rw-r--r-- | ipc/shm.c | 15 |
1 files changed, 7 insertions, 8 deletions
| @@ -91,8 +91,8 @@ static inline int shm_addid(struct shmid_kernel *shp) | |||
| 91 | static inline void shm_inc (int id) { | 91 | static inline void shm_inc (int id) { |
| 92 | struct shmid_kernel *shp; | 92 | struct shmid_kernel *shp; |
| 93 | 93 | ||
| 94 | if(!(shp = shm_lock(id))) | 94 | shp = shm_lock(id); |
| 95 | BUG(); | 95 | BUG_ON(!shp); |
| 96 | shp->shm_atim = get_seconds(); | 96 | shp->shm_atim = get_seconds(); |
| 97 | shp->shm_lprid = current->tgid; | 97 | shp->shm_lprid = current->tgid; |
| 98 | shp->shm_nattch++; | 98 | shp->shm_nattch++; |
| @@ -142,8 +142,8 @@ static void shm_close (struct vm_area_struct *shmd) | |||
| 142 | 142 | ||
| 143 | mutex_lock(&shm_ids.mutex); | 143 | mutex_lock(&shm_ids.mutex); |
| 144 | /* remove from the list of attaches of the shm segment */ | 144 | /* remove from the list of attaches of the shm segment */ |
| 145 | if(!(shp = shm_lock(id))) | 145 | shp = shm_lock(id); |
| 146 | BUG(); | 146 | BUG_ON(!shp); |
| 147 | shp->shm_lprid = current->tgid; | 147 | shp->shm_lprid = current->tgid; |
| 148 | shp->shm_dtim = get_seconds(); | 148 | shp->shm_dtim = get_seconds(); |
| 149 | shp->shm_nattch--; | 149 | shp->shm_nattch--; |
| @@ -283,8 +283,7 @@ asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) | |||
| 283 | err = -EEXIST; | 283 | err = -EEXIST; |
| 284 | } else { | 284 | } else { |
| 285 | shp = shm_lock(id); | 285 | shp = shm_lock(id); |
| 286 | if(shp==NULL) | 286 | BUG_ON(shp==NULL); |
| 287 | BUG(); | ||
| 288 | if (shp->shm_segsz < size) | 287 | if (shp->shm_segsz < size) |
| 289 | err = -EINVAL; | 288 | err = -EINVAL; |
| 290 | else if (ipcperms(&shp->shm_perm, shmflg)) | 289 | else if (ipcperms(&shp->shm_perm, shmflg)) |
| @@ -774,8 +773,8 @@ invalid: | |||
| 774 | up_write(¤t->mm->mmap_sem); | 773 | up_write(¤t->mm->mmap_sem); |
| 775 | 774 | ||
| 776 | mutex_lock(&shm_ids.mutex); | 775 | mutex_lock(&shm_ids.mutex); |
| 777 | if(!(shp = shm_lock(shmid))) | 776 | shp = shm_lock(shmid); |
| 778 | BUG(); | 777 | BUG_ON(!shp); |
| 779 | shp->shm_nattch--; | 778 | shp->shm_nattch--; |
| 780 | if(shp->shm_nattch == 0 && | 779 | if(shp->shm_nattch == 0 && |
| 781 | shp->shm_perm.mode & SHM_DEST) | 780 | shp->shm_perm.mode & SHM_DEST) |
