Skip to contentSkip to conversation

arm64: Fix flush_icache_range prototype

PATCH New Marc Zyngier 2 participants 2 messages Oct 23, 2017 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Fix flush_icache_range prototype

flush_icache_range can return -EFAULT, and yet its prototype has void as a return type. Fix it by aligning it to that of __flush_cache_user_range.

---
 arch/arm64/include/asm/cacheflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/cacheflush.h +1 -1
index 76d1cc85d5b1..377fa6b5d67f 100644
@@ -65,7 +65,7 @@
  *		- kaddr  - page address
  *		- size   - region size
  */
-extern void flush_icache_range(unsigned long start, unsigned long end);
+extern long flush_icache_range(unsigned long start, unsigned long end);
 extern void __flush_dcache_area(void *addr, size_t len);
 extern void __inval_dcache_area(void *addr, size_t len);
 extern void __clean_dcache_area_poc(void *addr, size_t len);
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 arm64: Fix flush_icache_range prototype

Quoted 14 lines · Marc Zyngier

flush_icache_range can return -EFAULT, and yet its prototype has void as a return type. Fix it by aligning it to that of __flush_cache_user_range.

---
 arch/arm64/include/asm/cacheflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/cacheflush.h +0 -0
index 76d1cc85d5b1..377fa6b5d67f 100644

arch/arm64/include/asm/cacheflush.h line 68

Quoted 5 lines
arch/arm64/include/asm/cacheflush.h +1 -1
@@ -65,7 +65,7 @@
  *		- kaddr  - page address
  *		- size   - region size
  */
-extern void flush_icache_range(unsigned long start, unsigned long end);
+extern long flush_icache_range(unsigned long start, unsigned long end);

Oh blimey, I hadn't realised that. However, this is used in the core code, which expects a void return type and I'd like to avoid the risk of compiler warnings complaining that the returned value is not used. I don't think there's a problem with leaving this as void, since the PCS already says that x0 is caller saved and this is out-of-line asm.

It just means that we silently handle userspace addresses, rather than trigger a panic in the absence of software-PAN.

Will