Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942413AbcJ1SLy (ORCPT ); Fri, 28 Oct 2016 14:11:54 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55681 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934180AbcJ1SLx (ORCPT ); Fri, 28 Oct 2016 14:11:53 -0400 From: Colin King To: Andrew Morton , Davidlohr Bueso , Manfred Spraul , Peter Zijlstra , Ingo Molnar , Nikolay Borisov Cc: linux-kernel@vger.kernel.org Subject: [PATCH] ipc/sem: ensure we left shift a ULL rather than a 32 bit integer Date: Fri, 28 Oct 2016 19:11:29 +0100 Message-Id: <20161028181129.7311-1-colin.king@canonical.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 865 Lines: 28 From: Colin Ian King 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: 7c24530cb4e3c0ae ("ipc/sem: optimize perform_atomic_semop()") Signed-off-by: Colin Ian King --- ipc/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/sem.c b/ipc/sem.c index ebd18a7..ca4aa23 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1839,7 +1839,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; -- 2.9.3