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


Groups > linux.kernel > #1636780

Is iounmap(NULL) safe or not?

From Alexey Khoroshilov <khoroshilov@ispras.ru>
Newsgroups linux.kernel
Subject Is iounmap(NULL) safe or not?
Date 2017-05-06 01:00 +0200
Message-ID <tDUmB-84F-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web