All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-cachefs@redhat.com, kernel-janitors@vger.kernel.org
Subject: [PATCH] fscache: Fix a NULL vs IS_ERR() bug in fscache_alloc_volume()
Date: Fri, 3 Dec 2021 12:56:08 +0300	[thread overview]
Message-ID: <20211203095608.GC2480@kili> (raw)

The fscache_lookup_cache() function does not return NULL, it returns
error pointers.

Fixes: 27beaec4d546 ("fscache: Implement volume registration")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/fscache/volume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fscache/volume.c b/fs/fscache/volume.c
index 4d0c2d43d54f..10f741c2072f 100644
--- a/fs/fscache/volume.c
+++ b/fs/fscache/volume.c
@@ -208,7 +208,7 @@ static struct fscache_volume *fscache_alloc_volume(const char *volume_key,
 	char *key;
 
 	cache = fscache_lookup_cache(cache_name, false);
-	if (!cache)
+	if (IS_ERR(cache))
 		return NULL;
 
 	volume = kzalloc(sizeof(*volume), GFP_KERNEL);
-- 
2.20.1


                 reply	other threads:[~2021-12-03  9:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211203095608.GC2480@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cachefs@redhat.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.