All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Colin King <colin.king@canonical.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] io-wq: fix unintentional integer overflow on left shift
Date: Fri, 25 Oct 2019 13:56:00 +0000	[thread overview]
Message-ID: <02517010-9244-771f-d0ce-558bbebe6a63@kernel.dk> (raw)
In-Reply-To: <fc23061e-31ec-8a66-2b62-771121d182de@kernel.dk>

On 10/25/19 6:54 AM, Jens Axboe wrote:
> On 10/25/19 6:43 AM, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Shifting the integer value 1U is evaluated with type unsigned int
>> using 32-bit arithmetic and then used in an expression that expects
>> a 64-bit value, so there is potentially an integer overflow. Fix this
>> by using the BIT_ULL macro to perform the shift and avoid the overflow.
> 
> Good catch, that should indeed have been 1ULL. I'll fold in your
> fix, thanks!

BTW, this missed the same issue on the clear side of it, in
io_worker_handle_work(). I've fixed that one up the same way.

-- 
Jens Axboe

WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Colin King <colin.king@canonical.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] io-wq: fix unintentional integer overflow on left shift
Date: Fri, 25 Oct 2019 07:56:00 -0600	[thread overview]
Message-ID: <02517010-9244-771f-d0ce-558bbebe6a63@kernel.dk> (raw)
In-Reply-To: <fc23061e-31ec-8a66-2b62-771121d182de@kernel.dk>

On 10/25/19 6:54 AM, Jens Axboe wrote:
> On 10/25/19 6:43 AM, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Shifting the integer value 1U is evaluated with type unsigned int
>> using 32-bit arithmetic and then used in an expression that expects
>> a 64-bit value, so there is potentially an integer overflow. Fix this
>> by using the BIT_ULL macro to perform the shift and avoid the overflow.
> 
> Good catch, that should indeed have been 1ULL. I'll fold in your
> fix, thanks!

BTW, this missed the same issue on the clear side of it, in
io_worker_handle_work(). I've fixed that one up the same way.

-- 
Jens Axboe


  reply	other threads:[~2019-10-25 13:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 12:43 [PATCH][next] io-wq: fix unintentional integer overflow on left shift Colin King
2019-10-25 12:43 ` Colin King
2019-10-25 12:54 ` Jens Axboe
2019-10-25 12:54   ` Jens Axboe
2019-10-25 13:56   ` Jens Axboe [this message]
2019-10-25 13:56     ` Jens Axboe
2019-10-25 13:59     ` Colin Ian King
2019-10-25 13:59       ` Colin Ian King
2019-10-25 13:59       ` Jens Axboe
2019-10-25 13:59         ` Jens Axboe

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=02517010-9244-771f-d0ce-558bbebe6a63@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.