Skip to content

Commit d523dc7

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fix from Catalin Marinas: "Fix uninitialised variable warning (from smatch) in the arm64 compat alignment fixup code" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: compat: Work around uninitialized variable warning
2 parents a1e6fff + 32d8599 commit d523dc7

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

arch/arm64/kernel/compat_alignment.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -314,36 +314,32 @@ int do_compat_alignment_fixup(unsigned long addr, struct pt_regs *regs)
314314
int (*handler)(unsigned long addr, u32 instr, struct pt_regs *regs);
315315
unsigned int type;
316316
u32 instr = 0;
317-
u16 tinstr = 0;
318317
int isize = 4;
319318
int thumb2_32b = 0;
320-
int fault;
321319

322320
instrptr = instruction_pointer(regs);
323321

324322
if (compat_thumb_mode(regs)) {
325323
__le16 __user *ptr = (__le16 __user *)(instrptr & ~1);
324+
u16 tinstr, tinst2;
326325

327-
fault = alignment_get_thumb(regs, ptr, &tinstr);
328-
if (!fault) {
329-
if (IS_T32(tinstr)) {
330-
/* Thumb-2 32-bit */
331-
u16 tinst2;
332-
fault = alignment_get_thumb(regs, ptr + 1, &tinst2);
333-
instr = ((u32)tinstr << 16) | tinst2;
334-
thumb2_32b = 1;
335-
} else {
336-
isize = 2;
337-
instr = thumb2arm(tinstr);
338-
}
326+
if (alignment_get_thumb(regs, ptr, &tinstr))
327+
return 1;
328+
329+
if (IS_T32(tinstr)) { /* Thumb-2 32-bit */
330+
if (alignment_get_thumb(regs, ptr + 1, &tinst2))
331+
return 1;
332+
instr = ((u32)tinstr << 16) | tinst2;
333+
thumb2_32b = 1;
334+
} else {
335+
isize = 2;
336+
instr = thumb2arm(tinstr);
339337
}
340338
} else {
341-
fault = alignment_get_arm(regs, (__le32 __user *)instrptr, &instr);
339+
if (alignment_get_arm(regs, (__le32 __user *)instrptr, &instr))
340+
return 1;
342341
}
343342

344-
if (fault)
345-
return 1;
346-
347343
switch (CODING_BITS(instr)) {
348344
case 0x00000000: /* 3.13.4 load/store instruction extensions */
349345
if (LDSTHD_I_BIT(instr))

0 commit comments

Comments
 (0)