[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <117846.1722608282@warthog.procyon.org.uk>
Date: Fri, 02 Aug 2024 15:18:02 +0100
From: David Howells <dhowells@...hat.com>
To: Simon Horman <horms@...nel.org>
Cc: dhowells@...hat.com, Christian Brauner <christian@...uner.io>,
Steve French <smfrench@...il.com>,
Matthew Wilcox <willy@...radead.org>,
Jeff Layton <jlayton@...nel.org>,
Gao Xiang <hsiangkao@...ux.alibaba.com>,
Dominique Martinet <asmadeus@...ewreck.org>,
Marc Dionne <marc.dionne@...istor.com>,
Paulo Alcantara <pc@...guebit.com>,
Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>,
Eric Van Hensbergen <ericvh@...nel.org>,
Ilya Dryomov <idryomov@...il.com>, netfs@...ts.linux.dev,
linux-afs@...ts.infradead.org, linux-cifs@...r.kernel.org,
linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org,
v9fs@...ts.linux.dev, linux-erofs@...ts.ozlabs.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 18/24] netfs: Speed up buffered reading
Simon Horman <horms@...nel.org> wrote:
> If the code ever reaches this line, then slice will be used
> uninitialised below.
It can't actually happen (or, at least, it shouldn't). There are only three
ways of obtaining data: downloading from the server
(NETFS_DOWNLOAD_FROM_SERVER), reading from the cache (NETFS_READ_FROM_CACHE)
and just clearing space (NETFS_FILL_WITH_ZEROES); each of those has its own
if-statement that will set 'slice' or will switch the source to a different
type that will set 'slice'.
The problem is that the compiler doesn't know this.
The check for NETFS_INVALID_READ is there just in case. Possibly:
if (source == NETFS_INVALID_READ)
break;
could be replaced with a WARN_ON_ONCE() and an unconditional break.
David
Powered by blists - more mailing lists