Skip to contentSkip to conversation

fscache: Fix a NULL vs IS_ERR() bug in fscache_alloc_volume()

PATCH New Dan Carpenter 1 participant 1 message Dec 3, 2021 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fscache: Fix a NULL vs IS_ERR() bug in fscache_alloc_volume()

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

Fixes 27beaec4d546 ("fscache: Implement volume registration")
---
 fs/fscache/volume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fscache/volume.c +1 -1
index 4d0c2d43d54f..10f741c2072f 100644
@@ -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);
Signature · 1 line
2.20.1