From 4791d94bc35335103fbce1719e32ffe84b8b2776 Mon Sep 17 00:00:00 2001 From: Ksawlii Date: Sun, 24 Nov 2024 00:23:50 +0100 Subject: [PATCH] Revert "mmc: mmc_test: Fix NULL dereference on allocation failure" This reverts commit b70b468ec3339f174778c98a0d4f6bb9df6fdfd9. --- drivers/mmc/core/mmc_test.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 9ebd5cebd..b9b6f0001 100755 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -3125,13 +3125,13 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); #ifdef CONFIG_HIGHMEM test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER); - if (!test->highmem) { - count = -ENOMEM; - goto free_test_buffer; - } #endif +#ifdef CONFIG_HIGHMEM + if (test->buffer && test->highmem) { +#else if (test->buffer) { +#endif mutex_lock(&mmc_test_lock); mmc_test_run(test, testcase); mutex_unlock(&mmc_test_lock); @@ -3139,7 +3139,6 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, #ifdef CONFIG_HIGHMEM __free_pages(test->highmem, BUFFER_ORDER); -free_test_buffer: #endif kfree(test->buffer); kfree(test);