Skip to contentSkip to conversation

mmc: test: Fix potential __free_pages(NULL) in mmc_test

PATCH New Chris Ball 1 participant 1 message Jun 19, 2014 MMC, SD and SDIO

lore
Share & tools
lore

Chris Ball

author
#0 lore raw

PATCH 1/1 mmc: test: Fix potential __free_pages(NULL) in mmc_test

alloc_pages() can return NULL, in which case we'll pass NULL to __free_pages().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=78391

---
 drivers/mmc/card/mmc_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/card/mmc_test.c +2 -1
index 0c0fc52..c86da32 100644
@@ -2884,7 +2884,8 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
 	}
 
 #ifdef CONFIG_HIGHMEM
-	__free_pages(test->highmem, BUFFER_ORDER);
+	if (test->highmem)
+            __free_pages(test->highmem, BUFFER_ORDER);
 #endif
 	kfree(test->buffer);
 	kfree(test);
Signature · 1 line
Chris Ball   <http://printf.net/>