summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2000-07-25 21:18:47 +0000
committermarkm <markm@FreeBSD.org>2000-07-25 21:18:47 +0000
commit12a237a692a81328f3f14927af016b53de12eabd (patch)
treed58170d695bea67ad11d489d9a5a743980675bfc /sys/dev/syscons
parent218edb7befe15334d4053ab8e1621558da5eccb0 (diff)
downloadFreeBSD-src-12a237a692a81328f3f14927af016b53de12eabd.zip
FreeBSD-src-12a237a692a81328f3f14927af016b53de12eabd.tar.gz
o Fix a horrible bug where small reads (< 8 bytes) would return the
wrong bytes. o Improve the public interface; use void* instead of char* or u_int64_t to pass arbitrary data around. Submitted by: kris ("horrible bug")
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c3
-rw-r--r--sys/dev/syscons/sysmouse.c5
2 files changed, 2 insertions, 6 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index cbcace8..2a447f7 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -2956,9 +2956,8 @@ next_code:
if (!(c & RELKEY))
sc_touch_scrn_saver();
- /* do the /dev/random device a favour */
if (!(flags & SCGETC_CN))
- random_harvest((u_int64_t)c, 1, 0, RANDOM_KEYBOARD);
+ random_harvest(&c, sizeof(c), 1, 0, RANDOM_KEYBOARD);
if (scp->kbd_mode != K_XLATE)
return KEYCHAR(c);
diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c
index 5c92b23..3f13de2 100644
--- a/sys/dev/syscons/sysmouse.c
+++ b/sys/dev/syscons/sysmouse.c
@@ -334,10 +334,7 @@ sysmouse_event(mouse_info_t *info)
sysmouse_tty);
}
- /* do the /dev/random device a favour */
- /* The nasty-looking cast is to force treatment of 8 u_chars */
- /* in buf as a u_int64_t */
- random_harvest(*((u_int64_t *)buf), 2, 0, RANDOM_MOUSE);
+ random_harvest(buf, sizeof(buf), 2, 0, RANDOM_MOUSE);
return mouse_status.flags;
}
OpenPOWER on IntegriCloud