]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.ubifs: Fix runtime assertions when running without crypto
authorHenri Roosen <henriroosen@gmail.com>
Mon, 8 Mar 2021 14:57:10 +0000 (15:57 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Mon, 22 Mar 2021 00:24:01 +0000 (01:24 +0100)
Running mkfs.ubifs which was build without crypto triggered the
following assertion:

mkfs.ubifs: ubifs-utils/mkfs.ubifs/fscrypt.h:166:
inherit_fscrypt_context: Assertion `0' failed.

A previous commit-cc4c5e295f54 ("mkfs.ubifs: Enable support for building
without crypto") added a check for an existing fscrypt context before calling
functions inherit_fscrypt_context() and free_fscrypt_context(),
however did not properly do this for each call to these functions.

Fixes: cc4c5e295f54 ("mkfs.ubifs: Enable support for building without crypto")
Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubifs-utils/mkfs.ubifs/fscrypt.h

index 34b799c94c2bc1b4171954554ad9d8055d8a7bdf..ff3d326bb1acbbcee63ea001d90d59cc6404df6c 100644 (file)
@@ -131,7 +131,7 @@ static inline void free_fscrypt_context(struct fscrypt_context *fctx)
 {
        (void)fctx;
 
-       assert(0);
+       assert(!fctx);
 }
 
 static inline int encrypt_path(void **outbuf, void *data, unsigned int data_len,
@@ -163,7 +163,7 @@ static inline struct fscrypt_context *inherit_fscrypt_context(struct fscrypt_con
 {
        (void)fctx;
 
-       assert(0);
+       assert(!fctx);
        return NULL;
 }
 #endif /* WITH_CRYPTO */