Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636780 > unrolled thread

Is iounmap(NULL) safe or not?

Started byAlexey Khoroshilov <khoroshilov@ispras.ru>
First post2017-05-06 01:00 +0200
Last post2017-05-06 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Is iounmap(NULL) safe or not? Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-05-06 01:00 +0200
    Re: Is iounmap(NULL) safe or not? Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2017-05-06 09:50 +0200

#1636780 — Is iounmap(NULL) safe or not?

FromAlexey Khoroshilov <khoroshilov@ispras.ru>
Date2017-05-06 01:00 +0200
SubjectIs iounmap(NULL) safe or not?
Message-ID<tDUmB-84F-3@gated-at.bofh.it>
Hello,

It seems thare are many places where code assumes iounmap(NULL) is safe.
Also there are several patches that state it explicitly:
  ff6defa6a8fa ("ALSA: Deletion of checks before the function call "iounmap")
  e24bb0ed8179 ("staging: dgnc: remove NULL test")

At the same time it seems PPC implementation generates a warning in this case:
  3bfafd6b136b ("netxen: avoid invalid iounmap")

  arch/powerpc/mm/pgtable_64.c:
	if ((unsigned long)addr < ioremap_bot) {
		printk(KERN_WARNING "Attempt to iounmap early bolted mapping"
		       " at 0x%p\n", addr);
		return;
	}

Could you please clarify if iounmap(NULL) safe or not.
I guess it would be less errorprone if the answer is architecture independent.

--
Thank you,
Alexey Khoroshilov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org

[toc] | [next] | [standalone]


#1636837

FromBenjamin Herrenschmidt <benh@kernel.crashing.org>
Date2017-05-06 09:50 +0200
Message-ID<tE2Dv-5c1-1@gated-at.bofh.it>
In reply to#1636780
On Sat, 2017-05-06 at 01:50 +0300, Alexey Khoroshilov wrote:
> Could you please clarify if iounmap(NULL) safe or not.
> I guess it would be less errorprone if the answer is architecture independent.

I think it's supposed to be and we should fix ppc.

Cheers,
Ben.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web