From: Manfred Spraul <manfred@colorfullife.com>
To: Colin King <colin.king@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, Nikolay Borisov <kernel@kyup.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc/sem: ensure we left shift a ULL rather than a 32 bit integer
Date: Fri, 28 Oct 2016 21:21:58 +0200 [thread overview]
Message-ID: <8570d3d4-aeaf-7d2e-7d04-3234264959fd@colorfullife.com> (raw)
In-Reply-To: <20161028181129.7311-1-colin.king@canonical.com>
Hi Colin,
On 10/28/2016 08:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
Good catch, thanks.
> CoverityScan CID#1372862 "Bad bit shift operation"
>
> Fixes: 7c24530cb4e3c0ae ("ipc/sem: optimize perform_atomic_semop()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 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);
>
Why 1ULL? Is 1UL not sufficient?
--
Manfred
next prev parent reply other threads:[~2016-10-28 19:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 18:11 Colin King
2016-10-28 19:21 ` Manfred Spraul [this message]
2016-10-28 19:29 ` Colin Ian King
2016-10-30 15:33 ` Manfred Spraul
2016-10-28 22:15 ` Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8570d3d4-aeaf-7d2e-7d04-3234264959fd@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@linux-foundation.org \
--cc=colin.king@canonical.com \
--cc=dave@stgolabs.net \
--cc=kernel@kyup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®