[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAWJmAYox7VNCzj7FnRdiX450wd=DtZAcZv3_2JiPmBuLvUMeQ@mail.gmail.com>
Date: Thu, 28 May 2020 20:51:41 +0800
From: Tao pilgrim <pilgrimtao@...il.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Alexey Dobriyan <adobriyan@...il.com>,
Muchun Song <songmuchun@...edance.com>
Subject: Re: [PATCH] proc/fd: Remove the initialization of variables in seq_show()
> > 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
Powered by blists - more mailing lists