}
}
-static unsigned long insn_get_effective_ip(struct pt_regs *regs)
+static int insn_get_effective_ip(struct pt_regs *regs, unsigned long *ip)
{
unsigned long seg_base = 0;
if (!user_64bit_mode(regs)) {
seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS);
if (seg_base == -1L)
- return 0;
+ return -EINVAL;
}
- return seg_base + regs->ip;
+ *ip = seg_base + regs->ip;
+
+ return 0;
}
/**
unsigned long ip;
int not_copied;
- ip = insn_get_effective_ip(regs);
- if (!ip)
+ if (insn_get_effective_ip(regs, &ip))
return 0;
not_copied = copy_from_user(buf, (void __user *)ip, MAX_INSN_SIZE);
unsigned long ip;
int not_copied;
- ip = insn_get_effective_ip(regs);
- if (!ip)
+ if (insn_get_effective_ip(regs, &ip))
return 0;
not_copied = __copy_from_user_inatomic(buf, (void __user *)ip, MAX_INSN_SIZE);