summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/code-patching.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/code-patching.h')
-rw-r--r--arch/powerpc/include/asm/code-patching.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 21a36e2c4e26..e7f14720f630 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -95,11 +95,17 @@ int patch_ulong(void *addr, unsigned long val);
static inline int patch_uint(void *addr, unsigned int val)
{
+ if (!IS_ALIGNED((unsigned long)addr, sizeof(unsigned int)))
+ return -EINVAL;
+
return patch_instruction(addr, ppc_inst(val));
}
static inline int patch_ulong(void *addr, unsigned long val)
{
+ if (!IS_ALIGNED((unsigned long)addr, sizeof(unsigned long)))
+ return -EINVAL;
+
return patch_instruction(addr, ppc_inst(val));
}