The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b4a9e6d81447c46c7bae56dc798097d9d3a4c495

commit b4a9e6d81447c46c7bae56dc798097d9d3a4c495
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2023-12-27 00:00:01 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2023-12-27 00:01:26 +0000

    hptmv: Handle errors from copyout() in hpt_set_info()
    
    This is in preparation for annotating copyin() and related functions
    with __result_use_check.
    
    MFC after:      1 week
---
 sys/dev/hptmv/hptproc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/hptmv/hptproc.c b/sys/dev/hptmv/hptproc.c
index 136b9c59a02a..8f9fffdc5af1 100644
--- a/sys/dev/hptmv/hptproc.c
+++ b/sys/dev/hptmv/hptproc.c
@@ -338,13 +338,13 @@ hpt_set_info(int length)
                        
                        if (err==0) {
                                if (piop->nOutBufferSize)
-                                       copyout(ke_area + piop->nInBufferSize, 
(void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize);
+                                       err = -copyout(ke_area + 
piop->nInBufferSize, (void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize);
                                
-                               if (piop->lpBytesReturned)
-                                       copyout(&dwRet, 
(void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD));
+                               if (err == 0 && piop->lpBytesReturned)
+                                       err = -copyout(&dwRet, 
(void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD));
                        
                                free(ke_area, M_DEVBUF);
-                               return length;
+                               return err == 0 ? length : err;
                        }
                        else  KdPrintW(("Kernel_ioctl(): return %d\n", err));
 

Reply via email to