Skip to contentSkip to conversation

x86,ioapic: use snrpintf while set names for IO-APIC resourses

PATCH In review Cyrill Gorcunov 1 participant 2 messages Nov 8, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86,ioapic: use snrpintf while set names for IO-APIC resourses

We should be ready that one day MAX_IO_APICS may raise its number. To prevent memory overwrite we're to use safe snprintf while set IO-APIC resourse name.

---
 arch/x86/kernel/apic/io_apic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/io_apic.c +1 -1
Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
=====================================================================
@@ -4099,7 +4099,7 @@ static struct resource * __init ioapic_s
 	for (i = 0; i < nr_ioapics; i++) {
 		res[i].name = mem;
 		res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-		sprintf(mem,  "IOAPIC %u", i);
+		snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
 		mem += IOAPIC_RESOURCE_NAME_SIZE;
 	}
 
#1 lore raw

[tip:x86/apic] x86, ioapic: Use snrpintf while set names for IO-APIC resourses

Commit-ID:  4343fe1024e09e17667f95620ed3e69a7a5f4389
Gitweb:     http://git.kernel.org/tip/4343fe1024e09e17667f95620ed3e69a7a5f4389
Author:     Cyrill Gorcunov <[email protected]>
AuthorDate: Sun, 8 Nov 2009 18:54:31 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 8 Nov 2009 17:06:23 +0100

x86, ioapic: Use snrpintf while set names for IO-APIC resourses

We should be ready that one day MAX_IO_APICS may raise its number. To prevent memory overwrite we're to use safe snprintf while set IO-APIC resourse name.

LKML-Reference: <20091108155431.GC25940@lenovo>

---
 arch/x86/kernel/apic/io_apic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -1
index 9ee1c16..24d1458 100644
@@ -4066,7 +4066,7 @@ static struct resource * __init ioapic_setup_resources(int nr_ioapics)
 	for (i = 0; i < nr_ioapics; i++) {
 		res[i].name = mem;
 		res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-		sprintf(mem,  "IOAPIC %u", i);
+		snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
 		mem += IOAPIC_RESOURCE_NAME_SIZE;
 	}