lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Apr 2022 10:12:57 +0200
From:   Vincent Whitchurch <vincent.whitchurch@...s.com>
To:     Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Rich Felker <dalias@...c.org>
CC:     <kernel@...s.com>, <hch@....de>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        kernel test robot <lkp@...el.com>,
        <linux-sh@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] sh: make !MMU iounmap an inline function

The current definition of sh's !MMU iounmap makes it unusable in certain
kinds of code, such as this instance caught by 0day on a patch posted to
the mailing lists:

 In file included from include/linux/io.h:13,
                  from drivers/mtd/devices/phram.c:21:
 drivers/mtd/devices/phram.c: In function 'register_device':
 arch/sh/include/asm/io.h:274:33: error: expected expression before 'do'
   274 | #define iounmap(addr)           do { } while (0)
       |                                 ^~
 drivers/mtd/devices/phram.c:150:44: note: in expansion of macro 'iounmap'
   150 |         cached ? memunmap(new->mtd.priv) : iounmap(new->mtd.priv);
       |                                            ^~~~~~~

Make it an inline function as it was earlier.

Link: https://lore.kernel.org/lkml/202204131446.omJ5mC54-lkp@intel.com/
Fixes: 13f1fc870dd747131 ("sh: move the ioremap implementation out of line")
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
---
 arch/sh/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index cf9a3ec32406..6bb978cf2ece 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -271,7 +271,7 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
 #endif /* CONFIG_HAVE_IOREMAP_PROT */
 
 #else /* CONFIG_MMU */
-#define iounmap(addr)		do { } while (0)
+static inline void iounmap(void __iomem *addr) {};
 #define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
 #endif /* CONFIG_MMU */
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ