Module Name: src
Committed By: rin
Date: Mon Sep 30 00:34:05 UTC 2024
Modified Files:
src/sys/arch/vax/vsa: gpx.c
Log Message:
vax/gpx: Stop copy{in,out}(9) from/to 0-length buffers
Found by GCC12 -Wmaybe-uninitialized.
Authored by kalvisd@.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/vax/vsa/gpx.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/vax/vsa/gpx.c
diff -u src/sys/arch/vax/vsa/gpx.c:1.3 src/sys/arch/vax/vsa/gpx.c:1.4
--- src/sys/arch/vax/vsa/gpx.c:1.3 Sat Feb 3 16:21:25 2024
+++ src/sys/arch/vax/vsa/gpx.c Mon Sep 30 00:34:04 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: gpx.c,v 1.3 2024/02/03 16:21:25 tsutsui Exp $ */
+/* $NetBSD: gpx.c,v 1.4 2024/09/30 00:34:04 rin Exp $ */
/* $OpenBSD: gpx.c,v 1.25 2014/12/23 21:39:12 miod Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
@@ -1147,6 +1147,9 @@ gpx_getcmap(struct gpx_screen *ss, struc
if (index >= colcount || count > colcount - index)
return EINVAL;
+ if (count == 0)
+ return 0;
+
/* extract reds */
c = ss->ss_cmap + 0 + index * 3;
for (i = count, r = ramp; i != 0; i--)