[RFC PATCH v1 3/9] x86/umip: Be stricter in fixup_umip_exception()
"Christophe Leroy (CS GROUP)" <[email protected]> Mon, 27 Apr 2026 19:13:44 +0200
| Newsgroups | gmane.comp.freedesktop.xorg.drivers.intel,gmane.linux.ports.alpha,gmane.linux.kernel,gmane.linux.kernel.arc,gmane.linux.ports.arm.kernel,gmane.linux.ports.mips,gmane.linux.ports.ppc64.devel,gmane.comp.emulators.kvm.devel,gmane.linux.ports.riscv,gmane.linux.ports.sparc,gmane.linux.uml.devel,gmane.linux.kernel.efi,gmane.comp.freedesktop.amd-gfx,gmane.comp.video.dri.devel,gmane.linux.network,gmane.linux.kernel.wireless.general,gmane.linux.kernel.spi.devel,gmane.linux.drivers.video-input-infrastructure,gmane.linux.serial,gmane.linux.usb.general,gmane.comp.emulators.xen.devel,gmane.linux.file-systems,gmane.linux.kernel.bpf,gmane.linux.kernel.mm,gmane.linux.x25,gmane.linux.kernel.rust,gmane.linux.sound,gmane.linux.ports.hexagon,gmane.linux.ports.parisc,gmane.linux.ports.sh.devel,gmane.linux.kernel.cross-arch |
|---|---|
| Message-ID | <9e8e43d4f81d8f8b6f68311f1c6f859d718d36e4.1777306795.git.chleroy@kernel.org> |
fixup_umip_exception() calls copy_to_user() and checks whether the returned value is strictly positive. A subsequent patch will change the return of copy_to_user() to return -EFAULT in case of error. Change the test to checking that the result is not 0. At the time being copy_to_user() return an unsigned value so 'strictly positive' is the same as 'not 0'. Signed-off-by: Christophe Leroy (CS GROUP) <[email protected]> --- arch/x86/kernel/umip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c index 3ce99cbcf187..dfff28ea1dea 100644 --- a/arch/x86/kernel/umip.c +++ b/arch/x86/kernel/umip.c @@ -409,7 +409,7 @@ bool fixup_umip_exception(struct pt_regs *regs) return false; nr_copied = copy_to_user(uaddr, dummy_data, dummy_data_size); - if (nr_copied > 0) { + if (nr_copied) { /* * If copy fails, send a signal and tell caller that * fault was fixed up. -- 2.49.0