mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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 <mcroce@linux.microsoft.com>
Link: https://lore.kernel.org/lkml/20200706234045.9516-1-mcroce@linux.microsoft.com
Fixes: cb3bee0369 ("pstore: Use crypto compress API")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
			
			
This commit is contained in:
		
							parent
							
								
									48778464bb
								
							
						
					
					
						commit
						fd49e03280
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -269,6 +269,9 @@ static int pstore_compress(const void *in, void *out,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION))
 | 
				
			||||||
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = crypto_comp_compress(tfm, in, inlen, out, &outlen);
 | 
						ret = crypto_comp_compress(tfm, in, inlen, out, &outlen);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		pr_err("crypto_comp_compress failed, ret = %d!\n", ret);
 | 
							pr_err("crypto_comp_compress failed, ret = %d!\n", ret);
 | 
				
			||||||
| 
						 | 
					@ -668,7 +671,7 @@ static void decompress_record(struct pstore_record *record)
 | 
				
			||||||
	int unzipped_len;
 | 
						int unzipped_len;
 | 
				
			||||||
	char *unzipped, *workspace;
 | 
						char *unzipped, *workspace;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!record->compressed)
 | 
						if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Only PSTORE_TYPE_DMESG support compression. */
 | 
						/* Only PSTORE_TYPE_DMESG support compression. */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue