Linux Modules
 help / color / mirror / Atom feed
* [PATCH] module: procfs: fix signed integer overflow in module_total_size()
@ 2026-06-03 16:24 Naveen Kumar Chaudhary
  2026-06-05 20:52 ` Sami Tolvanen
  0 siblings, 1 reply; 2+ messages in thread
From: Naveen Kumar Chaudhary @ 2026-06-03 16:24 UTC (permalink / raw)
  To: mcgrof, petr.pavlu, da.gomez, samitolvanen
  Cc: atomlin, linux-modules, linux-kernel

module_total_size() accumulates unsigned section sizes into a signed int
before returning as unsigned int. If the total exceeds INT_MAX, this is
signed integer overflow.

Change the accumulator to unsigned int to match the return type.

Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>
---
 kernel/module/procfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module/procfs.c b/kernel/module/procfs.c
index 0a4841e88adb..90712aa9dd13 100644
--- a/kernel/module/procfs.c
+++ b/kernel/module/procfs.c
@@ -64,7 +64,7 @@ static void m_stop(struct seq_file *m, void *p)
 
 static unsigned int module_total_size(struct module *mod)
 {
-	int size = 0;
+	unsigned int size = 0;
 
 	for_each_mod_mem_type(type)
 		size += mod->mem[type].size;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-05 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 16:24 [PATCH] module: procfs: fix signed integer overflow in module_total_size() Naveen Kumar Chaudhary
2026-06-05 20:52 ` Sami Tolvanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox