diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/shm.c | 15 | ||||
-rw-r--r-- | ipc/util.c | 6 |
2 files changed, 9 insertions, 12 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) |
diff --git a/ipc/util.c b/ipc/util.c index 23151ef32590..5e785a29e1e6 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -266,8 +266,7 @@ struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id) | |||
266 | { | 266 | { |
267 | struct kern_ipc_perm* p; | 267 | struct kern_ipc_perm* p; |
268 | int lid = id % SEQ_MULTIPLIER; | 268 | int lid = id % SEQ_MULTIPLIER; |
269 | if(lid >= ids->entries->size) | 269 | BUG_ON(lid >= ids->entries->size); |
270 | BUG(); | ||
271 | 270 | ||
272 | /* | 271 | /* |
273 | * do not need a rcu_dereference()() here to force ordering | 272 | * do not need a rcu_dereference()() here to force ordering |
@@ -275,8 +274,7 @@ struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id) | |||
275 | */ | 274 | */ |
276 | p = ids->entries->p[lid]; | 275 | p = ids->entries->p[lid]; |
277 | ids->entries->p[lid] = NULL; | 276 | ids->entries->p[lid] = NULL; |
278 | if(p==NULL) | 277 | BUG_ON(p==NULL); |
279 | BUG(); | ||
280 | ids->in_use--; | 278 | ids->in_use--; |
281 | 279 | ||
282 | if (lid == ids->max_id) { | 280 | if (lid == ids->max_id) { |