Skip to contentSkip to conversation

fscache_aquire_cache: error instead of asserting name is set

PATCH New Dominique Martinet 1 participant 1 message Mar 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fscache_aquire_cache: error instead of asserting name is set

name comes straight from the cachefilesd config file, so return an error that the daemon handles and reports instead of printing a kernel stack in dmesg

---
 fs/fscache/cache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/fscache/cache.c +3 -1
index 2749933852a9..6115b974585d 100644
@@ -150,7 +150,9 @@ struct fscache_cache *fscache_acquire_cache(const char *name)
 {
 	struct fscache_cache *cache;
 
-	ASSERT(name);
+	if (!name)
+		return ERR_PTR(-EINVAL);
+
 	cache = fscache_lookup_cache(name, true);
 	if (IS_ERR(cache))
 		return cache;
Signature · 1 line
2.35.1