From e6beb7b2374ec4eb98e503890c4b38cda51a1844 Mon Sep 17 00:00:00 2001 From: CTurt Date: Sat, 30 Jan 2016 09:58:28 +0000 Subject: [PATCH] HBSD: Check result of copyin https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206755 Signed-off-by: CTurt --- sys/dev/tdfx/tdfx_pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 918857a8abbc..0d50af633fe8 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -631,17 +631,20 @@ tdfx_query_update(u_int cmd, struct tdfx_pio_data *piod) * at once to the ports */ switch (piod->size) { case 1: - copyin(piod->value, &ret_byte, 1); + if (copyin(piod->value, &ret_byte, 1)) + return -EFAULT; preval = ret_byte << (8 * (piod->port & 0x3)); mask = 0xff << (8 * (piod->port & 0x3)); break; case 2: - copyin(piod->value, &ret_word, 2); + if (copyin(piod->value, &ret_word, 2)) + return -EFAULT; preval = ret_word << (8 * (piod->port & 0x3)); mask = 0xffff << (8 * (piod->port & 0x3)); break; case 4: - copyin(piod->value, &ret_dword, 4); + if (copyin(piod->value, &ret_dword, 4)) + return -EFAULT; preval = ret_dword; mask = ~0; break;