All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
@ 2014-03-18 10:20 ` Liu Hua
  0 siblings, 0 replies; 6+ messages in thread
From: Liu Hua @ 2014-03-18 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
overflow if pfn >= 0x100000 in copy_oldmem_page.

So use __pfn_to_phys for converting.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
---
 arch/arm/kernel/crash_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c
index 90c50d4..5d1286d 100644
--- a/arch/arm/kernel/crash_dump.c
+++ b/arch/arm/kernel/crash_dump.c
@@ -39,7 +39,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 
-- 
1.8.5.5.dirty

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

* [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
@ 2014-03-18 10:20 ` Liu Hua
  0 siblings, 0 replies; 6+ messages in thread
From: Liu Hua @ 2014-03-18 10:20 UTC (permalink / raw)
  To: linux; +Cc: linux-arm-kernel, linux-kernel, peifeiyue, wangnan0, Liu Hua

When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
overflow if pfn >= 0x100000 in copy_oldmem_page.

So use __pfn_to_phys for converting.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
---
 arch/arm/kernel/crash_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c
index 90c50d4..5d1286d 100644
--- a/arch/arm/kernel/crash_dump.c
+++ b/arch/arm/kernel/crash_dump.c
@@ -39,7 +39,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 
-- 
1.8.5.5.dirty


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

* [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
  2014-03-18 10:20 ` Liu Hua
@ 2014-03-18 10:48   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-03-18 10:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 18, 2014 at 06:20:42PM +0800, Liu Hua wrote:
> When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
> overflow if pfn >= 0x100000 in copy_oldmem_page.
> 
> So use __pfn_to_phys for converting.

Yes.  The sad thing is that if you grep the kernel for similar things,
it's littered with this problem.  I'm not sure whether anyone
particularly "owns" the crash_dump.c file - Mika Westerberg and
Olaf Hering were the last two to touch it... I guess put this in my
patch system please.

Thanks.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

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

* Re: [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
@ 2014-03-18 10:48   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-03-18 10:48 UTC (permalink / raw)
  To: Liu Hua; +Cc: wangnan0, linux-kernel, linux-arm-kernel, peifeiyue

On Tue, Mar 18, 2014 at 06:20:42PM +0800, Liu Hua wrote:
> When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
> overflow if pfn >= 0x100000 in copy_oldmem_page.
> 
> So use __pfn_to_phys for converting.

Yes.  The sad thing is that if you grep the kernel for similar things,
it's littered with this problem.  I'm not sure whether anyone
particularly "owns" the crash_dump.c file - Mika Westerberg and
Olaf Hering were the last two to touch it... I guess put this in my
patch system please.

Thanks.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

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

* [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
  2014-03-18 10:48   ` Russell King - ARM Linux
@ 2014-03-22  5:14     ` Liu hua
  -1 siblings, 0 replies; 6+ messages in thread
From: Liu hua @ 2014-03-22  5:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 2014/3/18 18:48, Russell King - ARM Linux wrote:
> On Tue, Mar 18, 2014 at 06:20:42PM +0800, Liu Hua wrote:
>> When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
>> overflow if pfn >= 0x100000 in copy_oldmem_page.
>>
>> So use __pfn_to_phys for converting.
> 
> Yes.  The sad thing is that if you grep the kernel for similar things,
> it's littered with this problem.  I'm not sure whether anyone
> particularly "owns" the crash_dump.c file - Mika Westerberg and
> Olaf Hering were the last two to touch it... I guess put this in my
> patch system please.
> 
> Thanks.
> 

Yes, I found this problem in serval places after a quick review. I will
do a check on this.

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

* Re: [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr
@ 2014-03-22  5:14     ` Liu hua
  0 siblings, 0 replies; 6+ messages in thread
From: Liu hua @ 2014-03-22  5:14 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: wangnan0, linux-kernel, linux-arm-kernel, peifeiyue

On 2014/3/18 18:48, Russell King - ARM Linux wrote:
> On Tue, Mar 18, 2014 at 06:20:42PM +0800, Liu Hua wrote:
>> When we configure CONFIG_LPAE=y, pfn << PAGE_SHIFT will
>> overflow if pfn >= 0x100000 in copy_oldmem_page.
>>
>> So use __pfn_to_phys for converting.
> 
> Yes.  The sad thing is that if you grep the kernel for similar things,
> it's littered with this problem.  I'm not sure whether anyone
> particularly "owns" the crash_dump.c file - Mika Westerberg and
> Olaf Hering were the last two to touch it... I guess put this in my
> patch system please.
> 
> Thanks.
> 

Yes, I found this problem in serval places after a quick review. I will
do a check on this.


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

end of thread, other threads:[~2014-03-22  5:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 10:20 [PATCH] ARM: kdump: Avoid overflow when converting pfn to physaddr Liu Hua
2014-03-18 10:20 ` Liu Hua
2014-03-18 10:48 ` Russell King - ARM Linux
2014-03-18 10:48   ` Russell King - ARM Linux
2014-03-22  5:14   ` Liu hua
2014-03-22  5:14     ` Liu hua

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.