From c3f4ec050f56eeab7c1f290321f9b762c95bd332 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 18 Apr 2020 09:07:51 +0200 Subject: m68k/PCI: Fix a memory leak in an error handling path If 'ioremap' fails, we must free 'bridge', as done in other error handling path bellow. Fixes: 19cc4c843f40 ("m68k/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks") Signed-off-by: Christophe JAILLET Reviewed-by: Geert Uytterhoeven Signed-off-by: Greg Ungerer --- arch/m68k/coldfire/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index 62b0eb6cf69a..84eab0f5e00a 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -216,8 +216,10 @@ static int __init mcf_pci_init(void) /* Keep a virtual mapping to IO/config space active */ iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); - if (iospace == 0) + if (iospace == 0) { + pci_free_host_bridge(bridge); return -ENODEV; + } pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", (u32) iospace); -- cgit v1.2.3 From e00091071615378e66291c61ea02d02d15a2cc7e Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 1 May 2020 21:30:21 -0700 Subject: m68k: Drop CONFIG_MTD_M25P80 in stmark2_defconfig Drop CONFIG_MTD_M25P80 that was removed in commit b35b9a10362d ("mtd: spi-nor: Move m25p80 code in spi-nor.c") Signed-off-by: Bin Meng Signed-off-by: Greg Ungerer --- arch/m68k/configs/stmark2_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/m68k/configs/stmark2_defconfig b/arch/m68k/configs/stmark2_defconfig index 27fa9465d19d..2b746f55f419 100644 --- a/arch/m68k/configs/stmark2_defconfig +++ b/arch/m68k/configs/stmark2_defconfig @@ -48,7 +48,6 @@ CONFIG_MTD_CFI_STAA=y CONFIG_MTD_ROM=y CONFIG_MTD_COMPLEX_MAPPINGS=y CONFIG_MTD_PLATRAM=y -CONFIG_MTD_M25P80=y CONFIG_MTD_SPI_NOR=y # CONFIG_INPUT_KEYBOARD is not set # CONFIG_INPUT_MOUSE is not set -- cgit v1.2.3 From ce3e83759c674ae7c04938d3577dbf0f3144c8f0 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Fri, 29 May 2020 21:02:17 +0200 Subject: m68k,nommu: add missing __user in uaccess' __ptr() macro The assembly for __get_user() & __put_user() uses a macro, __ptr(), to cast the pointer to 'unsigned long *' but the pointer is always a __user one and so this cast creates a lot of warnings when using Sparse. So, change to the cast to 'unsigned long __user *'. Reported-by: kbuild test robot Signed-off-by: Luc Van Oostenryck Signed-off-by: Greg Ungerer --- arch/m68k/include/asm/uaccess_no.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/uaccess_no.h b/arch/m68k/include/asm/uaccess_no.h index a24cfe4a0d32..9651766a62af 100644 --- a/arch/m68k/include/asm/uaccess_no.h +++ b/arch/m68k/include/asm/uaccess_no.h @@ -60,7 +60,7 @@ extern int __put_user_bad(void); * aliasing issues. */ -#define __ptr(x) ((unsigned long *)(x)) +#define __ptr(x) ((unsigned long __user *)(x)) #define __put_user_asm(err,x,ptr,bwl) \ __asm__ ("move" #bwl " %0,%1" \ -- cgit v1.2.3 From 9e2b6ed41f8f99c97b13c9d15cbef235dbd97fb6 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Fri, 29 May 2020 21:02:18 +0200 Subject: m68k,nommu: fix implicit cast from __user in __{get,put}_user_asm() The assembly for __get_user_asm() & __put_user_asm() uses memcpy() when the size is 8. However, the pointer is always a __user one while memcpy() expects a plain one and so this cast creates a lot of warnings when using Sparse. So, fix this by adding a cast to 'void __force *' at memcpy()'s argument. Reported-by: kbuild test robot Signed-off-by: Luc Van Oostenryck Signed-off-by: Greg Ungerer --- arch/m68k/include/asm/uaccess_no.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/m68k/include/asm/uaccess_no.h b/arch/m68k/include/asm/uaccess_no.h index 9651766a62af..dcfb69361408 100644 --- a/arch/m68k/include/asm/uaccess_no.h +++ b/arch/m68k/include/asm/uaccess_no.h @@ -42,7 +42,7 @@ static inline int _access_ok(unsigned long addr, unsigned long size) __put_user_asm(__pu_err, __pu_val, ptr, l); \ break; \ case 8: \ - memcpy(ptr, &__pu_val, sizeof (*(ptr))); \ + memcpy((void __force *)ptr, &__pu_val, sizeof(*(ptr))); \ break; \ default: \ __pu_err = __put_user_bad(); \ @@ -85,7 +85,7 @@ extern int __put_user_bad(void); u64 l; \ __typeof__(*(ptr)) t; \ } __gu_val; \ - memcpy(&__gu_val.l, ptr, sizeof(__gu_val.l)); \ + memcpy(&__gu_val.l, (const void __force *)ptr, sizeof(__gu_val.l)); \ (x) = __gu_val.t; \ break; \ } \ -- cgit v1.2.3