diff mbox series

[v2] mkfs.ubifs: Fix runtime assertions when running without crypto

Message ID 20210308145710.6203-1-henri.roosen@ginzinger.com
State Accepted
Delegated to: David Oberhollenzer
Headers show
Series [v2] mkfs.ubifs: Fix runtime assertions when running without crypto | expand

Commit Message

Henri Roosen March 8, 2021, 2:57 p.m. UTC
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>
---
Changes since v1:
 - instead of patching every call site, allow inline functions
   inherit_fscrypt_context() and free_fscrypt_context() to be called with NULL
   fscrypt context.

 ubifs-utils/mkfs.ubifs/fscrypt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Oberhollenzer March 22, 2021, 12:27 a.m. UTC | #1
Applied to mtd-utils.git master.

Thanks,

David
diff mbox series

Patch

diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.h b/ubifs-utils/mkfs.ubifs/fscrypt.h
index 34b799c..ff3d326 100644
--- a/ubifs-utils/mkfs.ubifs/fscrypt.h
+++ b/ubifs-utils/mkfs.ubifs/fscrypt.h
@@ -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 */