Skip to content

Commit fd49e03

Browse files
Matteo Crocekees
authored andcommitted
pstore: Fix linking when crypto API disabled
When building a kernel with CONFIG_PSTORE=y and CONFIG_CRYPTO not set, a build error happens: ld: fs/pstore/platform.o: in function `pstore_dump': platform.c:(.text+0x3f9): undefined reference to `crypto_comp_compress' ld: fs/pstore/platform.o: in function `pstore_get_backend_records': platform.c:(.text+0x784): undefined reference to `crypto_comp_decompress' This because some pstore code uses crypto_comp_(de)compress regardless of the CONFIG_CRYPTO status. Fix it by wrapping the (de)compress usage by IS_ENABLED(CONFIG_PSTORE_COMPRESS) Signed-off-by: Matteo Croce <[email protected]> Link: https://lore.kernel.org/lkml/[email protected] Fixes: cb3bee0 ("pstore: Use crypto compress API") Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 4877846 commit fd49e03

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/pstore/platform.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ static int pstore_compress(const void *in, void *out,
269269
{
270270
int ret;
271271

272+
if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION))
273+
return -EINVAL;
274+
272275
ret = crypto_comp_compress(tfm, in, inlen, out, &outlen);
273276
if (ret) {
274277
pr_err("crypto_comp_compress failed, ret = %d!\n", ret);
@@ -668,7 +671,7 @@ static void decompress_record(struct pstore_record *record)
668671
int unzipped_len;
669672
char *unzipped, *workspace;
670673

671-
if (!record->compressed)
674+
if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed)
672675
return;
673676

674677
/* Only PSTORE_TYPE_DMESG support compression. */

0 commit comments

Comments
 (0)