Commit 7b62a955047934bab158e84ecb63cb432c193ace

Authored by j_mayer
1 parent 5e692ecd

Add missing definition for number of input pins for the PowerPC 970 bus.

Use proper INPUT_NB definitions to allocate PowerPC input pins structure,
  fixing a buffer overflow in the 6xx bus case.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3659 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 5 additions and 2 deletions
hw/ppc.c
@@ -172,7 +172,8 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) @@ -172,7 +172,8 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level)
172 172
173 void ppc6xx_irq_init (CPUState *env) 173 void ppc6xx_irq_init (CPUState *env)
174 { 174 {
175 - env->irq_inputs = (void **)qemu_allocate_irqs(&ppc6xx_set_irq, env, 6); 175 + env->irq_inputs = (void **)qemu_allocate_irqs(&ppc6xx_set_irq, env,
  176 + PPC6xx_INPUT_NB);
176 } 177 }
177 178
178 #if defined(TARGET_PPC64) 179 #if defined(TARGET_PPC64)
@@ -295,7 +296,8 @@ static void ppc970_set_irq (void *opaque, int pin, int level) @@ -295,7 +296,8 @@ static void ppc970_set_irq (void *opaque, int pin, int level)
295 296
296 void ppc970_irq_init (CPUState *env) 297 void ppc970_irq_init (CPUState *env)
297 { 298 {
298 - env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, env, 7); 299 + env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, env,
  300 + PPC970_INPUT_NB);
299 } 301 }
300 #endif /* defined(TARGET_PPC64) */ 302 #endif /* defined(TARGET_PPC64) */
301 303
target-ppc/cpu.h
@@ -1249,6 +1249,7 @@ enum { @@ -1249,6 +1249,7 @@ enum {
1249 PPC970_INPUT_MCP = 4, 1249 PPC970_INPUT_MCP = 4,
1250 PPC970_INPUT_INT = 5, 1250 PPC970_INPUT_INT = 5,
1251 PPC970_INPUT_THINT = 6, 1251 PPC970_INPUT_THINT = 6,
  1252 + PPC970_INPUT_NB,
1252 }; 1253 };
1253 #endif 1254 #endif
1254 1255