From ca640ca965d3ffab4a5fd86f6fa2683aa3f2fb7a Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sat, 26 Mar 2005 18:01:35 +0000 Subject: [PATCH] check copyin return values when loading pallete Noticed by: Coverity Prevent analysis tool --- sys/dev/fb/vga.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 55530bb43a4..b32625f46e8 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -2891,10 +2891,13 @@ set_palette(video_adapter_t *adp, int base, int count, r = malloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; - copyin(red, r, count); - copyin(green, g, count); - copyin(blue, b, count); - err = vga_load_palette2(adp, base, count, r, g, b); + err = copyin(red, r, count); + if (!err) + err = copyin(green, g, count); + if (!err) + err = copyin(blue, b, count); + if (!err) + err = vga_load_palette2(adp, base, count, r, g, b); free(r, M_DEVBUF); return (err ? ENODEV : 0);