Re: [PATCH][next] mm/execmem: Remove logically deadcode in execmem.c

From: Shuah Khan
Date: Thu Oct 10 2024 - 17:51:31 EST


On 10/10/24 12:10, Everest K.C. wrote:
NULL check of variable `area` within the `mas_for_each` loop is
unnecessary, as the varialbe `area` can never be NULL. So, the
`continue` statement inside the if block is never reached.

Remove the if block that performs the NULL check.

This was reported by Coverity Scan:
https://scan7.scan.coverity.com/#/project-view/51525/11354?selectedIssue=1600362

Fixes: d44c3485820e ("execmem: add support for cache of large ROX pages")
Signed-off-by: Everest K.C. <everestkc@xxxxxxxxxxxxxxxx>
---
mm/execmem.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/mm/execmem.c b/mm/execmem.c
index 9c6ff9687860..97706d8ed720 100644
--- a/mm/execmem.c
+++ b/mm/execmem.c
@@ -75,9 +75,6 @@ static void execmem_cache_clean(struct work_struct *work)
mas_for_each(&mas, area, ULONG_MAX) {
size_t size;
- if (!area)
- continue;
-

This more of a question than comment:
mas_for_each() says:
Note: may return the zero entry.

Does that mean mas_range_len() can be zero? Does that
need to be handled?


size = mas_range_len(&mas);
if (IS_ALIGNED(size, PMD_SIZE) &&


thanks,
-- Shuah