mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
d60b6c803c
The early_ioremap interface can fail and return NULL in certain cases. To prevent NULL-pointer dereference crashes, fixed issues in the acpi_extlog and copy_early_mem interfaces, improving robustness when handling early memory. Link: https://lkml.kernel.org/r/20241212101004.1544070-1-guoweikang.kernel@gmail.com Signed-off-by: Guo Weikang <guoweikang.kernel@gmail.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Baoquan He <bhe@redhat.com> Cc: Borislav Petkov (AMD) <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jason A. Donenfeld <Jason@zx2c4.com> Cc: Julian Stecklina <julian.stecklina@cyberus-technology.de> Cc: Kevin Loughlin <kevinloughlin@google.com> Cc: Len Brown <lenb@kernel.org> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Xin Li (Intel) <xin@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_EARLY_IOREMAP_H_
|
|
#define _ASM_EARLY_IOREMAP_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
/*
|
|
* early_ioremap() and early_iounmap() are for temporary early boot-time
|
|
* mappings, before the real ioremap() is functional.
|
|
*/
|
|
extern void __iomem *early_ioremap(resource_size_t phys_addr,
|
|
unsigned long size);
|
|
extern void *early_memremap(resource_size_t phys_addr,
|
|
unsigned long size);
|
|
extern void *early_memremap_ro(resource_size_t phys_addr,
|
|
unsigned long size);
|
|
extern void *early_memremap_prot(resource_size_t phys_addr,
|
|
unsigned long size, unsigned long prot_val);
|
|
extern void early_iounmap(void __iomem *addr, unsigned long size);
|
|
extern void early_memunmap(void *addr, unsigned long size);
|
|
|
|
#if defined(CONFIG_GENERIC_EARLY_IOREMAP) && defined(CONFIG_MMU)
|
|
/* Arch-specific initialization */
|
|
extern void early_ioremap_init(void);
|
|
|
|
/* Generic initialization called by architecture code */
|
|
extern void early_ioremap_setup(void);
|
|
|
|
/*
|
|
* Called as last step in paging_init() so library can act
|
|
* accordingly for subsequent map/unmap requests.
|
|
*/
|
|
extern void early_ioremap_reset(void);
|
|
|
|
/*
|
|
* Early copy from unmapped memory to kernel mapped memory.
|
|
*/
|
|
extern int copy_from_early_mem(void *dest, phys_addr_t src,
|
|
unsigned long size);
|
|
|
|
#else
|
|
static inline void early_ioremap_init(void) { }
|
|
static inline void early_ioremap_setup(void) { }
|
|
static inline void early_ioremap_reset(void) { }
|
|
#endif
|
|
|
|
#endif /* _ASM_EARLY_IOREMAP_H_ */
|