From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by kanga.kvack.org (Postfix) with ESMTP id B1CC26B02C4 for ; Fri, 5 May 2017 18:50:37 -0400 (EDT) Received: by mail-lf0-f69.google.com with SMTP id h4so4196872lfj.3 for ; Fri, 05 May 2017 15:50:37 -0700 (PDT) Received: from mail.ispras.ru (mail.ispras.ru. [83.149.199.45]) by mx.google.com with ESMTP id r10si3956479lfa.126.2017.05.05.15.50.35 for ; Fri, 05 May 2017 15:50:36 -0700 (PDT) From: Alexey Khoroshilov Subject: Is iounmap(NULL) safe or not? Date: Sat, 6 May 2017 01:50:08 +0300 Message-Id: <1494024608-10343-1-git-send-email-khoroshilov@ispras.ru> Sender: owner-linux-mm@kvack.org List-ID: To: Benjamin Herrenschmidt , Greg Kroah-Hartman Cc: Alexey Khoroshilov , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f69.google.com (mail-vk0-f69.google.com [209.85.213.69]) by kanga.kvack.org (Postfix) with ESMTP id 6E90E6B02C4 for ; Sat, 6 May 2017 03:47:32 -0400 (EDT) Received: by mail-vk0-f69.google.com with SMTP id m78so5367556vkf.8 for ; Sat, 06 May 2017 00:47:32 -0700 (PDT) Received: from gate.crashing.org (gate.crashing.org. [63.228.1.57]) by mx.google.com with ESMTPS id z1si2922790uaz.155.2017.05.06.00.47.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 06 May 2017 00:47:31 -0700 (PDT) Message-ID: <1494056846.25766.420.camel@kernel.crashing.org> Subject: Re: Is iounmap(NULL) safe or not? From: Benjamin Herrenschmidt Date: Sat, 06 May 2017 09:47:26 +0200 In-Reply-To: <1494024608-10343-1-git-send-email-khoroshilov@ispras.ru> References: <1494024608-10343-1-git-send-email-khoroshilov@ispras.ru> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Alexey Khoroshilov , Greg Kroah-Hartman Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org