linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is iounmap(NULL) safe or not?
@ 2017-05-05 22:50 Alexey Khoroshilov
  2017-05-06  7:47 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2017-05-05 22:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Greg Kroah-Hartman
  Cc: Alexey Khoroshilov, linux-mm, linuxppc-dev, linux-kernel, ldv-project

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

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

* Re: Is iounmap(NULL) safe or not?
  2017-05-05 22:50 Is iounmap(NULL) safe or not? Alexey Khoroshilov
@ 2017-05-06  7:47 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2017-05-06  7:47 UTC (permalink / raw)
  To: Alexey Khoroshilov, Greg Kroah-Hartman
  Cc: linux-mm, linuxppc-dev, linux-kernel, ldv-project

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.

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

end of thread, other threads:[~2017-05-06  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 22:50 Is iounmap(NULL) safe or not? Alexey Khoroshilov
2017-05-06  7:47 ` Benjamin Herrenschmidt

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).