Skip to contentSkip to conversation

powerpc: fix invalid pointer usage in ucc_slow_init()

PATCH Applied Timur Tabi 2 participants 5 messages Mar 15, 2007 PowerPC

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 powerpc: fix invalid pointer usage in ucc_slow_init()

In two places, ucc_slow_init() passes a physical address instead of the virtual address to functions that were expecting the latter, causing a kernel panic. us_info->regs contains the physical address of the UCC register set. The registers are ioremap'd to kernel space, and the virtual pointers are stored in us_regs. The code was using us_info->regs when it should have been using us_regs.

---
 arch/powerpc/sysdev/qe_lib/ucc_slow.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/qe_lib/ucc_slow.c +2 -2
index 817df73..b930d68 100644
@@ -187,7 +187,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
 	uccs->us_pram = qe_muram_addr(uccs->us_pram_offset);
 
 	/* Init Guemr register */
-	if ((ret = ucc_init_guemr((struct ucc_common *) (us_info->regs)))) {
+	if ((ret = ucc_init_guemr((struct ucc_common *) us_regs))) {
 		printk(KERN_ERR "%s: cannot init GUEMR", __FUNCTION__);
 		ucc_slow_free(uccs);
 		return ret;
@@ -195,7 +195,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
 
 	/* Set UCC to slow type */
 	if ((ret = ucc_set_type(us_info->ucc_num,
-				(struct ucc_common *) (us_info->regs),
+				(struct ucc_common *) us_regs,
 				UCC_SPEED_TYPE_SLOW))) {
 		printk(KERN_ERR "%s: cannot set UCC type", __FUNCTION__);
 		ucc_slow_free(uccs);
Signature · 1 line
1.5.0.2.260.g2eb065
#1 lore raw
Quoted 9 lines · Timur Tabi

In two places, ucc_slow_init() passes a physical address instead of the virtual address to functions that were expecting the latter, causing a kernel panic. us_info->regs contains the physical address of the UCC register set. The registers are ioremap'd to kernel space, and the virtual pointers are stored in us_regs. The code was using us_info->regs when it should have been using us_regs.

---

It's my understanding that there aren't any in kernel users of ucc_slow at the moment, is that true?

- k

author
#2 lore raw
Quoted 1 line · Kumar Gala

It's my understanding that there aren't any in kernel users of ucc_slow at the moment, is that true?

Yes. I'm working on the first - a UART driver.

#3 lore raw
Quoted 5 lines · Timur Tabi
Quoted 1 line · Kumar Gala

It's my understanding that there aren't any in kernel users of ucc_slow at the moment, is that true?

Yes. I'm working on the first - a UART driver.

Ok, I'll pull it into my tree for 2.6.22 then.

- k

Applied
#4 lore raw
In reply to Timur Tabi
Quoted 8 lines · Timur Tabi

In two places, ucc_slow_init() passes a physical address instead of the virtual address to functions that were expecting the latter, causing a kernel panic. us_info->regs contains the physical address of the UCC register set. The registers are ioremap'd to kernel space, and the virtual pointers are stored in us_regs. The code was using us_info->regs when it should have been using us_regs.

applied.

- k