Skip to content

Commit

Permalink
ipc/sem: ensure we left shift a ULL rather than a 32 bit integer
Browse files Browse the repository at this point in the history
The left shift amount is sop->sem_num % 64, which is up to 63, so
ensure we are shifting a ULL rather than a 32 bit value.

CoverityScan CID#1372862 "Bad bit shift operation"

Fixes: 7c24530 ("ipc/sem: optimize perform_atomic_semop()")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Colin Ian King <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Manfred Spraul <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Colin Ian King authored and hnaz committed Dec 1, 2016
1 parent d1516a0 commit ac95ef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,

max = 0;
for (sop = sops; sop < sops + nsops; sop++) {
unsigned long mask = 1 << ((sop->sem_num) % BITS_PER_LONG);
unsigned long mask = 1ULL << ((sop->sem_num) % BITS_PER_LONG);

if (sop->sem_num >= max)
max = sop->sem_num;
Expand Down

0 comments on commit ac95ef9

Please sign in to comment.