git: 4d3c234d8eb3 - main - sa: Check for errors from copyout()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Dec 2023 02:58:11 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4d3c234d8eb32f903d630b371208a0a931d3d5fe commit 4d3c234d8eb32f903d630b371208a0a931d3d5fe Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-12-27 21:28:28 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-12-28 01:28:25 +0000 sa: Check for errors from copyout() This is in preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: ken MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43203 --- sys/cam/scsi/scsi_sa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index aa4dc8e84c10..f84fc5bcb1ab 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1494,8 +1494,12 @@ saparamsetlist(struct cam_periph *periph, struct mtsetlist *list, bailout: if (need_copy != 0) { if (error != EFAULT) { + int error1; + cam_periph_unlock(periph); - copyout(params, list->params, list->param_len); + error1 = copyout(params, list->params, list->param_len); + if (error == 0) + error = error1; cam_periph_lock(periph); } free(params, M_SCSISA);