linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Russell King <linux@armlinux.org.uk>,
	Nicolas Pitre <nico@fluxnic.net>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org (open list),
	linus.walleij@linaro.org, Rob Herring <robh+dt@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH 1/2] ARM: Fix off by one in checking DMA zone size
Date: Thu, 24 Mar 2022 10:54:16 -0700	[thread overview]
Message-ID: <20220324175417.1014562-2-f.fainelli@gmail.com> (raw)
In-Reply-To: <20220324175417.1014562-1-f.fainelli@gmail.com>

The maximum DMA address is PAGE_OFFSET + arm_dma_zone_size - 1, fix this
by doing the appropriate subtraction.

Fixes: 650320181a08 ("ARM: change ARM_DMA_ZONE_SIZE into a variable")
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/include/asm/dma.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index a81dda65c576..f244ee68e814 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -11,7 +11,7 @@
 #define MAX_DMA_ADDRESS	({ \
 	extern phys_addr_t arm_dma_zone_size; \
 	arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
-		(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
+		(PAGE_OFFSET + arm_dma_zone_size - 1) : 0xffffffffUL; })
 #endif
 
 #ifdef CONFIG_ISA_DMA_API
-- 
2.25.1


  reply	other threads:[~2022-03-24 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 17:54 [PATCH 0/2] ARM: MAX_DMA_ADDRESS fixes Florian Fainelli
2022-03-24 17:54 ` Florian Fainelli [this message]
2022-03-24 19:02   ` [PATCH 1/2] ARM: Fix off by one in checking DMA zone size Linus Walleij
2022-04-29 15:15   ` Russell King (Oracle)
2022-04-29 15:45     ` Arnd Bergmann
2022-03-24 17:54 ` [PATCH 2/2] ARM: Clamp MAX_DMA_ADDRESS to 32-bit Florian Fainelli
2022-03-24 19:02   ` Linus Walleij
2022-03-24 20:31   ` Geert Uytterhoeven
2022-03-24 22:39     ` Florian Fainelli
2022-04-29 15:07     ` Russell King (Oracle)
2022-04-26 16:29 ` [PATCH 0/2] ARM: MAX_DMA_ADDRESS fixes Florian Fainelli

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=20220324175417.1014562-2-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=geert@linux-m68k.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nico@fluxnic.net \
    --cc=robh+dt@kernel.org \
    /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).