[PATCH] Add exception handling

From: cgel . zte
Date: Sat Sep 18 2021 - 03:47:37 EST


From: Yang Guang <yang.guang5@xxxxxxxxxx>

If the type is abnormal input from argument, the code will be NULL.
So it should return as default;

Signed-off-by: Yang Guang <yang.guang5@xxxxxxxxxx>
---
arch/x86/kernel/static_call.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/static_call.c b/arch/x86/kernel/static_call.c
index f608e6710300..696da3eccf28 100644
--- a/arch/x86/kernel/static_call.c
+++ b/arch/x86/kernel/static_call.c
@@ -45,6 +45,8 @@ static void __ref __static_call_transform(void *insn, enum insn_type type, void
code = text_gen_insn(RET_INSN_OPCODE, insn, func);
size = RET_INSN_SIZE;
break;
+ default:
+ return;
}

if (memcmp(insn, code, size) == 0)
--
2.25.1