BUG_ON() Conversion in ipc/shm.c
PATCH 3/4 BUG_ON() Conversion in ipc/shm.c
hi,
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away.
Signed-off-by Eric Sesterhenn <[email protected]>
ipc/shm.c renamed from ipc/shm.c.orig +7 -8
@@ -90,8 +90,8 @@ static inline int shm_addid(struct shmidstatic inline void shm_inc (int id) {struct shmid_kernel *shp; -if (!(shp =shm_lock (id))) -BUG (); + shp =shm_lock (id); +BUG_ON (!shp); shp->shm_atim =get_seconds (); shp->shm_lprid = current->tgid; shp->shm_nattch++;
@@ -141,8 +141,8 @@ static void shm_close (struct vm_area_stdown (&shm_ids.sem);/* remove from the list of attaches of the shm segment */ -if (!(shp =shm_lock (id))) -BUG (); + shp =shm_lock (id); +BUG_ON (!shp); shp->shm_lprid = current->tgid; shp->shm_dtim =get_seconds (); shp->shm_nattch--;
@@ -282,8 +282,7 @@ asmlinkage long sys_shmget (key_t key, s err = -EEXIST ; }else { shp =shm_lock (id); -if (shp==NULL ) -BUG (); +BUG_ON (shp==NULL );if (shp->shm_segsz < size) err = -EINVAL ;else if (ipcperms (&shp->shm_perm, shmflg))
@@ -772,8 +771,8 @@ invalid:up_write (¤t->mm->mmap_sem);down (&shm_ids.sem); -if (!(shp =shm_lock (shmid))) -BUG (); + shp =shm_lock (shmid); +BUG_ON (!shp); shp->shm_nattch--;if (shp->shm_nattch ==0 && shp->shm_perm.mode &SHM_DEST )
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
PATCH 3/4 BUG_ON() Conversion in ipc/util.c
hi,
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away.
Signed-off-by Eric Sesterhenn <[email protected]>
ipc/util.c renamed from ipc/util.c.orig +2 -4
@@ -265,8 +265,7 @@ struct kern_ipc_perm* ipc_rmid(struct ip {struct kern_ipc_perm * p;int lid = id %SEQ_MULTIPLIER ; -if (lid >= ids->entries->size) -BUG (); +BUG_ON (lid >= ids->entries->size);/* * do not need a rcu_dereference()() here to force ordering
@@ -274,8 +273,7 @@ struct kern_ipc_perm* ipc_rmid(struct ip*/ p = ids->entries->p[lid]; ids->entries->p[lid] =NULL ; -if (p==NULL ) -BUG (); +BUG_ON (p==NULL ); ids->in_use--;if (lid == ids->max_id) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors