linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86: Check return values for early memory/IO remap calls
@ 2022-11-10 15:45 Ross Philipson
  2022-11-10 15:45 ` [PATCH v2 1/2] x86: Check return values from early_memremap calls Ross Philipson
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ross Philipson @ 2022-11-10 15:45 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: ross.philipson, dpsmith, tglx, mingo, bp, hpa, luto, dave.hansen,
	kanth.ghatraju, trenchboot-devel, jailhouse-dev, jan.kiszka,
	xen-devel, jgross, boris.ostrovsky, andrew.cooper3

While sending an earlier patch set it was discovered that there are a
number of places in early x86 code were the functions early_memremap()
and early_ioremap() are called but the returned pointer is not checked
for NULL. Since NULL can be returned for a couple of reasons, the return
value should be checked for NULL.

This set fixes the places where the checks were missing. It was not always
clear what the best failure mode should be when NULL is detected. In modules
where other places tended to pr_warn or panic e.g., the same was done for
the checks. In other places it was based on how significantly fatal the
failure would end up being. The review process may point out places where
this should be changed.

Changes in v2:
 - Added notes in comments about why panic() was used in some cases and
the fact that maintainers approved the usage.
 - Added pr_fmt macros in changed files to allow proper usage of pr_*
printing macros.

Ross Philipson (2):
  x86: Check return values from early_memremap calls
  x86: Check return values from early_ioremap calls

 arch/x86/kernel/apic/x2apic_uv_x.c |  2 ++
 arch/x86/kernel/devicetree.c       | 13 ++++++++++
 arch/x86/kernel/e820.c             | 12 +++++++--
 arch/x86/kernel/early_printk.c     |  2 ++
 arch/x86/kernel/jailhouse.c        |  6 +++++
 arch/x86/kernel/mpparse.c          | 51 ++++++++++++++++++++++++++++----------
 arch/x86/kernel/setup.c            | 19 +++++++++++---
 arch/x86/kernel/vsmp_64.c          |  3 +++
 arch/x86/xen/enlighten_hvm.c       |  2 ++
 arch/x86/xen/mmu_pv.c              |  8 ++++++
 arch/x86/xen/setup.c               |  2 ++
 11 files changed, 102 insertions(+), 18 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-04 11:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 15:45 [PATCH v2 0/2] x86: Check return values for early memory/IO remap calls Ross Philipson
2022-11-10 15:45 ` [PATCH v2 1/2] x86: Check return values from early_memremap calls Ross Philipson
2022-11-10 16:07   ` Juergen Gross
2022-11-10 16:07   ` Dave Hansen
2022-11-10 19:30     ` Ross Philipson
2023-01-04 11:58     ` Borislav Petkov
2022-11-10 15:45 ` [PATCH v2 2/2] x86: Check return values from early_ioremap calls Ross Philipson
2022-11-10 18:07   ` Peter Zijlstra
2022-11-10 19:31     ` Ross Philipson
2023-01-03 20:36 ` [PATCH v2 0/2] x86: Check return values for early memory/IO remap calls Ross Philipson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).