Skip to contentSkip to conversation

module: Remove the unused function within

PATCH In review Jiapeng Chong 5 participants 6 messages Feb 10, 2023 – Feb 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: Remove the unused function within

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

kernel/module/main.c:3007:19: warning: unused function 'within'.

---
 kernel/module/main.c | 5 -----
 1 file changed, 5 deletions(-)
kernel/module/main.c +0 -5
index c598f11e7016..062065568b40 100644
@@ -3004,11 +3004,6 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
 	return load_module(&info, uargs, flags);
 }
 
-static inline int within(unsigned long addr, void *start, unsigned long size)
-{
-	return ((void *)addr >= start && (void *)addr < start + size);
-}
-
 /* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
 char *module_flags(struct module *mod, char *buf, bool show_state)
 {
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
Quoted 2 lines · Jiapeng Chong

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

Huh? It's used by __module_text_address(), no?

Quoted 28 lines

kernel/module/main.c:3007:19: warning: unused function 'within'.

---
kernel/module/main.c | 5 -----

1 file changed, 5 deletions(-)
kernel/module/main.c +0 -5
index c598f11e7016..062065568b40 100644
@@ -3004,11 +3004,6 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
 	return load_module(&info, uargs, flags);
 }
 
-static inline int within(unsigned long addr, void *start, unsigned long size)
-{
-	return ((void *)addr >= start && (void *)addr < start + size);
-}
-
 /* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
 char *module_flags(struct module *mod, char *buf, bool show_state)
 {
Signature · 1 line
2.20.1.7.g153144c
#2 lore raw
Quoted 5 lines · Chris Down
Quoted 2 lines · Jiapeng Chong

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

Huh? It's used by __module_text_address(), no?

Not after commit 2ece476a2346 ("module: replace module_layout with module_memory") in -next. This patch should have a fixes tag, even if the warning is currently hidden behind W=1.

Quoted 28 lines
Quoted 28 lines

kernel/module/main.c:3007:19: warning: unused function 'within'.

---
kernel/module/main.c | 5 -----

1 file changed, 5 deletions(-)
kernel/module/main.c +0 -5
index c598f11e7016..062065568b40 100644
@@ -3004,11 +3004,6 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
 	return load_module(&info, uargs, flags);
 }
 
-static inline int within(unsigned long addr, void *start, unsigned long size)
-{
-	return ((void *)addr >= start && (void *)addr < start + size);
-}
-
 /* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
 char *module_flags(struct module *mod, char *buf, bool show_state)
 {
Signature · 1 line
2.20.1.7.g153144c
#3 lore raw

+Cc: Song

Quoted 10 lines · Nathan Chancellor
Quoted 5 lines · Chris Down
Quoted 2 lines · Jiapeng Chong

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

Huh? It's used by __module_text_address(), no?

Not after commit 2ece476a2346 ("module: replace module_layout with module_memory") in -next. This patch should have a fixes tag, even if the warning is currently hidden behind W=1.

Huh, I thought I had checked out latest -next, but must have not done so somehow :-) Mea culpa.

If it's only in -next then no Fixes needed, since there's no stable rev yet.

Jiapeng, in future, please make sure to cc the author of related commits when reporting stuff like this :-) It helps people to update their patches.

Song, you probably want to update your patch.

reviewer
#4 lore raw

Hi Chris,

Quoted 2 lines · Chris Down

+Cc: Song

Thanks for the CC!

Quoted 16 lines
Quoted 10 lines · Nathan Chancellor
Quoted 5 lines · Chris Down
Quoted 2 lines · Jiapeng Chong

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

Huh? It's used by __module_text_address(), no?

Not after commit 2ece476a2346 ("module: replace module_layout with module_memory") in -next. This patch should have a fixes tag, even if the warning is currently hidden behind W=1.

Huh, I thought I had checked out latest -next, but must have not done so somehow :-) Mea culpa.

Quoted 6 lines

If it's only in -next then no Fixes needed, since there's no stable rev yet.

Jiapeng, in future, please make sure to cc the author of related commits when reporting stuff like this :-) It helps people to update their patches.

Song, you probably want to update your patch.

Luis, would you prefer a new patch with everything folded in? Or would you apply the patches on your end?

Thanks,
Song

maintainer
#5 lore raw
Quoted 26 lines · Song Liu

Hi Chris,

Quoted 2 lines · Chris Down

+Cc: Song

Thanks for the CC!

Quoted 18 lines
Quoted 10 lines · Nathan Chancellor
Quoted 5 lines · Chris Down
Quoted 2 lines · Jiapeng Chong

The function within is defined in the main.c file, but not called elsewhere, so remove this unused function.

Huh? It's used by __module_text_address(), no?

Not after commit 2ece476a2346 ("module: replace module_layout with module_memory") in -next. This patch should have a fixes tag, even if the warning is currently hidden behind W=1.

Huh, I thought I had checked out latest -next, but must have not done so somehow :-) Mea culpa.

If it's only in -next then no Fixes needed, since there's no stable rev yet.

Quoted 7 lines
Quoted 4 lines

Jiapeng, in future, please make sure to cc the author of related commits when reporting stuff like this :-) It helps people to update their patches.

Song, you probably want to update your patch.

Luis, would you prefer a new patch with everything folded in? Or would you apply the patches on your end?

I've merged this patch separately onto modules-next and enhanced the commit log to explain its needed after your patch.

Luis