Blame 0105-kpatch-build-Add-find_kobj-short-circuit-for-OOT-mod.patch

642cd7
From 7861240f482aa41bfad41fbb57ac1990cd6b6960 Mon Sep 17 00:00:00 2001
642cd7
From: Josh Poimboeuf <jpoimboe@redhat.com>
642cd7
Date: Wed, 17 Aug 2022 12:17:19 -0700
642cd7
Subject: [PATCH 105/108] kpatch-build: Add find_kobj() short-circuit for OOT
642cd7
 modules
642cd7
642cd7
When patching an OOT module, the parent object is always the OOT module.
642cd7
Hard-code that to prevent the need for any further special casing in
642cd7
find_kobj() (e.g., commit 9143e88f16a1 ("kpatch-build: fix
642cd7
find_parent_obj")).
642cd7
642cd7
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
642cd7
---
642cd7
 kpatch-build/kpatch-build | 18 ++++++++++++------
642cd7
 1 file changed, 12 insertions(+), 6 deletions(-)
642cd7
642cd7
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
642cd7
index 296fa48..5435a19 100755
642cd7
--- a/kpatch-build/kpatch-build
642cd7
+++ b/kpatch-build/kpatch-build
642cd7
@@ -479,6 +479,12 @@ find_parent_obj() {
642cd7
 
642cd7
 find_kobj() {
642cd7
 	arg="$1"
642cd7
+
642cd7
+	if [[ -n $OOT_MODULE ]]; then
642cd7
+		KOBJFILE="$OOT_MODULE"
642cd7
+		return
642cd7
+	fi
642cd7
+
642cd7
 	KOBJFILE="$arg"
642cd7
 	DEEP_FIND=0
642cd7
 	ERROR_IF_DIFF=
642cd7
@@ -1093,17 +1099,17 @@ for i in $FILES; do
642cd7
 	find_kobj "$i"
642cd7
 	cd "$TEMPDIR" || die
642cd7
 	if [[ -e "orig/$i" ]]; then
642cd7
-		if [[ "$(basename "$KOBJFILE")" = vmlinux ]]; then
642cd7
-			KOBJFILE_NAME=vmlinux
642cd7
-			KOBJFILE_PATH="$VMLINUX"
642cd7
-			SYMTAB="${TEMPDIR}/${KOBJFILE_NAME}.symtab"
642cd7
-			SYMVERS_FILE="$BUILDDIR/Module.symvers"
642cd7
-		elif [[ "$(basename "$KOBJFILE")" = "$(basename "$OOT_MODULE")" ]]; then
642cd7
+		if [[ -n $OOT_MODULE ]]; then
642cd7
 			KOBJFILE_NAME="$(basename --suffix=.ko "$OOT_MODULE")"
642cd7
 			KOBJFILE_NAME="${KOBJFILE_NAME//-/_}"
642cd7
 			KOBJFILE_PATH="$OOT_MODULE"
642cd7
 			SYMTAB="${TEMPDIR}/module/${KOBJFILE_NAME}.symtab"
642cd7
 			SYMVERS_FILE="$TEMPDIR/Module.symvers"
642cd7
+		elif [[ "$(basename "$KOBJFILE")" = vmlinux ]]; then
642cd7
+			KOBJFILE_NAME=vmlinux
642cd7
+			KOBJFILE_PATH="$VMLINUX"
642cd7
+			SYMTAB="${TEMPDIR}/${KOBJFILE_NAME}.symtab"
642cd7
+			SYMVERS_FILE="$BUILDDIR/Module.symvers"
642cd7
 		else
642cd7
 			KOBJFILE_NAME=$(basename "${KOBJFILE%.ko}")
642cd7
 			KOBJFILE_NAME="${KOBJFILE_NAME//-/_}"
642cd7
-- 
642cd7
2.37.3
642cd7