linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cho KyongHo <pullip.cho@samsung.com>
To: linux-arch@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: 'Russell King - ARM Linux' <linux@arm.linux.org.uk>,
	kgene.kim@samsung.com,
	'Younglak Kim' <younglak1004.kim@samsung.com>,
	'Sanghyun Lee' <sanghyun75.lee@samsung.com>,
	wooki.min@samsung.com
Subject: arm: mm: fix faulty calculation of area to perform cache operation
Date: Thu, 29 Mar 2012 18:55:32 +0900	[thread overview]
Message-ID: <002c01cd0d92$14acd5f0$3e0681d0$%cho@samsung.com> (raw)

In dma_cache_maint_page(), if offset is larger than PAGE_SIZE,
len becomes PAGE_SIZE - offset. If size is smaller than
PAGE_SIZE - offset, next calcuation of left cause overflow.

Signed-off-by: KyongHo Cho <pullip.cho@samsung.com>
---
 arch/arm/mm/dma-mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 1aa664a..14f53b6 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -517,7 +517,7 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
 					page += offset / PAGE_SIZE;
 					offset %= PAGE_SIZE;
 				}
-				len = PAGE_SIZE - offset;
+				len = min_t(size_t, PAGE_SIZE - offset, len);
 			}
 			vaddr = kmap_high_get(page);
 			if (vaddr) {
-- 
1.7.1

             reply	other threads:[~2012-03-29  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29  9:55 Cho KyongHo [this message]
2012-03-29 12:10 ` arm: mm: fix faulty calculation of area to perform cache operation Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002c01cd0d92$14acd5f0$3e0681d0$%cho@samsung.com' \
    --to=pullip.cho@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sanghyun75.lee@samsung.com \
    --cc=wooki.min@samsung.com \
    --cc=younglak1004.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).