From: Tao pilgrim <pilgrimtao@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Alexey Dobriyan <adobriyan@gmail.com>,
Muchun Song <songmuchun@bytedance.com>
Subject: Re: [PATCH] proc/fd: Remove the initialization of variables in seq_show()
Date: Thu, 28 May 2020 20:51:41 +0800 [thread overview]
Message-ID: <CAAWJmAYox7VNCzj7FnRdiX450wd=DtZAcZv3_2JiPmBuLvUMeQ@mail.gmail.com> (raw)
In-Reply-To: <e218bc34-b8cf-cf0d-aaf1-e1f259d29f7c@web.de>
> > The variables{files, file} will definitely be assigned,
>
> I find an other specification nicer for these identifiers.
>
>
> > so we don't need to initialize them.
>
> I suggest to recheck programming concerns around the handling
> of the null pointer for the variable “file”.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/fd.c?id=caffb99b6929f41a69edbb5aef3a359bf45f3315#n20
> https://elixir.bootlin.com/linux/v5.7-rc6/source/fs/proc/fd.c#L20
We don't need to initialize the variable “file”.
On line 34, if (files) is true,
{file = fcheck_files(files, fd)} will be executed on line 38.
On line 34, if (files) is flse,
{return ret;} will be executed on line 54, and seq_show() will exit directly.
I don't find the programming concerns around the handling of the null
pointer for the variable “file”.
If you have other suggestions, please elaborate on the details.
--
Yours,
Kaitao Cheng
WARNING: multiple messages have this Message-ID (diff)
From: Tao pilgrim <pilgrimtao@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Alexey Dobriyan <adobriyan@gmail.com>,
Muchun Song <songmuchun@bytedance.com>
Subject: Re: [PATCH] proc/fd: Remove the initialization of variables in seq_show()
Date: Thu, 28 May 2020 12:51:41 +0000 [thread overview]
Message-ID: <CAAWJmAYox7VNCzj7FnRdiX450wd=DtZAcZv3_2JiPmBuLvUMeQ@mail.gmail.com> (raw)
In-Reply-To: <e218bc34-b8cf-cf0d-aaf1-e1f259d29f7c@web.de>
> > The variables{files, file} will definitely be assigned,
>
> I find an other specification nicer for these identifiers.
>
>
> > so we don't need to initialize them.
>
> I suggest to recheck programming concerns around the handling
> of the null pointer for the variable “file”.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/fd.c?id=caffb99b6929f41a69edbb5aef3a359bf45f3315#n20
> https://elixir.bootlin.com/linux/v5.7-rc6/source/fs/proc/fd.c#L20
We don't need to initialize the variable “file”.
On line 34, if (files) is true,
{file = fcheck_files(files, fd)} will be executed on line 38.
On line 34, if (files) is flse,
{return ret;} will be executed on line 54, and seq_show() will exit directly.
I don't find the programming concerns around the handling of the null
pointer for the variable “file”.
If you have other suggestions, please elaborate on the details.
--
Yours,
Kaitao Cheng
next prev parent reply other threads:[~2020-05-28 12:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 7:46 [PATCH] proc/fd: Remove the initialization of variables in seq_show() Markus Elfring
2020-05-24 7:46 ` Markus Elfring
2020-05-28 12:51 ` Tao pilgrim [this message]
2020-05-28 12:51 ` Tao pilgrim
2020-05-28 16:04 ` Markus Elfring
2020-05-28 16:04 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-05-23 15:49 [PATCH] " Kaitao Cheng
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='CAAWJmAYox7VNCzj7FnRdiX450wd=DtZAcZv3_2JiPmBuLvUMeQ@mail.gmail.com' \
--to=pilgrimtao@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=adobriyan@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=songmuchun@bytedance.com \
/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.