Date: Fri, 12 Jan 2024 21:12:05 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 848a8bf3f40d - main - fb: Check for errors from copyin() Message-ID: <202401122112.40CLC5HB039216@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=848a8bf3f40d91bda0ae3ab67f22ed693f25f9c4 commit 848a8bf3f40d91bda0ae3ab67f22ed693f25f9c4 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-01-12 15:09:22 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-01-12 20:56:00 +0000 fb: Check for errors from copyin() When compiling with gcc, a function annotated with __result_use_check cannot have its return value ignored with a void cast. So, try to handle it. MFC after: 1 week --- sys/dev/fb/vesa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index e1cca3a70725..dcd3d34076bf 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -1732,11 +1732,15 @@ set_palette(video_adapter_t *adp, int base, int count, r = malloc(count * 3, M_DEVBUF, M_WAITOK | M_ZERO); g = r + count; b = g + count; - (void)copyin(red, r, count); - (void)copyin(green, g, count); - (void)copyin(blue, b, count); + if (copyin(red, r, count) != 0 || + copyin(green, g, count) != 0 || + copyin(blue, b, count) != 0) { + error = 1; + goto out; + } error = vesa_bios_load_palette2(base, count, r, g, b, bits); +out: free(r, M_DEVBUF); return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401122112.40CLC5HB039216>