From: Jens Axboe <axboe@kernel.dk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Colin King <colin.king@canonical.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] io_uring: ensure variable ret is initialized to zero
Date: Thu, 26 Sep 2019 11:42:08 +0000 [thread overview]
Message-ID: <04262621-68fd-a4bb-ab0c-83954c03fbb0@kernel.dk> (raw)
In-Reply-To: <20190926113329.GE27389@kadam>
On 9/26/19 1:33 PM, Dan Carpenter wrote:
> On Thu, Sep 26, 2019 at 11:56:30AM +0200, Jens Axboe wrote:
>> On 9/26/19 11:50 AM, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> In the case where sig is NULL the error variable ret is not initialized
>>> and may contain a garbage value on the final checks to see if ret is
>>> -ERESTARTSYS. Best to initialize ret to zero before the do loop to
>>> ensure the ret does not accidentially contain -ERESTARTSYS before the
>>> loop.
>>
>> Oops, weird it didn't complain. I've folded in this fix, as that commit
>> isn't upstream yet. Thanks!
>
> There is a bug in GCC where at certain optimization levels, instead of
> complaining, it initializes it to zero.
That's awfully nice of it ;-)
Tried with -O0 and still didn't complain for me.
$ gcc --version
gcc (Ubuntu 9.1.0-2ubuntu2~18.04) 9.1.0
Tried gcc 5/6/7/8 as well. Might have to go look at what code it's
generating.
--
Jens Axboe
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Colin King <colin.king@canonical.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] io_uring: ensure variable ret is initialized to zero
Date: Thu, 26 Sep 2019 13:42:08 +0200 [thread overview]
Message-ID: <04262621-68fd-a4bb-ab0c-83954c03fbb0@kernel.dk> (raw)
In-Reply-To: <20190926113329.GE27389@kadam>
On 9/26/19 1:33 PM, Dan Carpenter wrote:
> On Thu, Sep 26, 2019 at 11:56:30AM +0200, Jens Axboe wrote:
>> On 9/26/19 11:50 AM, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> In the case where sig is NULL the error variable ret is not initialized
>>> and may contain a garbage value on the final checks to see if ret is
>>> -ERESTARTSYS. Best to initialize ret to zero before the do loop to
>>> ensure the ret does not accidentially contain -ERESTARTSYS before the
>>> loop.
>>
>> Oops, weird it didn't complain. I've folded in this fix, as that commit
>> isn't upstream yet. Thanks!
>
> There is a bug in GCC where at certain optimization levels, instead of
> complaining, it initializes it to zero.
That's awfully nice of it ;-)
Tried with -O0 and still didn't complain for me.
$ gcc --version
gcc (Ubuntu 9.1.0-2ubuntu2~18.04) 9.1.0
Tried gcc 5/6/7/8 as well. Might have to go look at what code it's
generating.
--
Jens Axboe
next prev parent reply other threads:[~2019-09-26 11:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 9:50 [PATCH][next] io_uring: ensure variable ret is initialized to zero Colin King
2019-09-26 9:50 ` Colin King
2019-09-26 9:56 ` Jens Axboe
2019-09-26 9:56 ` Jens Axboe
2019-09-26 11:33 ` Dan Carpenter
2019-09-26 11:33 ` Dan Carpenter
2019-09-26 11:42 ` Jens Axboe [this message]
2019-09-26 11:42 ` Jens Axboe
2019-09-26 12:14 ` Rasmus Villemoes
2019-09-26 12:14 ` Rasmus Villemoes
2019-09-26 12:26 ` Jens Axboe
2019-09-26 12:26 ` 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=04262621-68fd-a4bb-ab0c-83954c03fbb0@kernel.dk \
--to=axboe@kernel.dk \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-block@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.