From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxwJP-00073O-50 for qemu-devel@nongnu.org; Tue, 11 Apr 2017 09:58:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxwJO-0007u4-K6 for qemu-devel@nongnu.org; Tue, 11 Apr 2017 09:58:27 -0400 From: Markus Armbruster References: <20170411131327.10734-1-mreitz@redhat.com> Date: Tue, 11 Apr 2017 15:58:18 +0200 In-Reply-To: <20170411131327.10734-1-mreitz@redhat.com> (Max Reitz's message of "Tue, 11 Apr 2017 15:13:27 +0200") Message-ID: <874lxvujut.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH for-2.9?] block/nfs: Do not strcmp() with NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-block@nongnu.org, Kevin Wolf , Jeff Cody , Peter Lieven , qemu-devel@nongnu.org Max Reitz writes: > Parsing the URI is not required to give us a scheme; uri->scheme may be > NULL. > > Signed-off-by: Max Reitz > --- > block/nfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/nfs.c b/block/nfs.c > index 0816678307..0c7d5619fe 100644 > --- a/block/nfs.c > +++ b/block/nfs.c > @@ -83,7 +83,7 @@ static int nfs_parse_uri(const char *filename, QDict *options, Error **errp) > error_setg(errp, "Invalid URI specified"); > goto out; > } > - if (strcmp(uri->scheme, "nfs") != 0) { > + if (!uri->scheme || strcmp(uri->scheme, "nfs") != 0) { > error_setg(errp, "URI scheme must be 'nfs'"); > goto out; > } Consider g_strcmp0().