[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0EgfQkrSr77jE12Wm_NKemEZ1rFZLMcVhkAuu1cwOOWQ@mail.gmail.com>
Date: Thu, 30 Jan 2020 16:36:48 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Christoph Hellwig <hch@...radead.org>
Cc: Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Oleksandr Natalenko <oleksandr@...hat.com>,
Bart Van Assche <bvanassche@....org>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
Marta Rybczynska <mrybczyn@...ray.eu>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-nvme@...ts.infradead.org, Hannes Reinecke <hare@...e.de>
Subject: Re: [PATCH] nvme: fix uninitialized-variable warning
On Thu, Jan 30, 2020 at 4:04 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Tue, Jan 07, 2020 at 10:42:08PM +0100, Arnd Bergmann wrote:
> > Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > ---
> > drivers/nvme/host/core.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index 667f18f465be..6f0991e8c5cc 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -825,14 +825,15 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
> > int ret;
> >
> > req = nvme_alloc_request(q, cmd, flags, qid);
> > - if (IS_ERR(req))
> > - return PTR_ERR(req);
> > + ret = PTR_ERR_OR_ZERO(req);
> > + if (ret < 0)
> > + return ret;
>
> This one is just gross. I think we'll need to find some other fix
> that doesn't obsfucate the code as much.
Initializing the nvme_result in nvme_features() would do it, as would
setting it in the error path in __nvme_submit_sync_cmd() -- either
way the compiler cannot be confused about whether it is initialized
later on.
Arnd
Powered by blists - more mailing lists