Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Fix an alignment problem with scan results within...
details: https://anonhg.NetBSD.org/src/rev/291ccbe4d667
branches: trunk
changeset: 356917:291ccbe4d667
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Oct 20 23:38:21 2017 +0000
description:
Fix an alignment problem with scan results within an escan event
diffstat:
sys/dev/ic/bwfm.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 347775f430ac -r 291ccbe4d667 sys/dev/ic/bwfm.c
--- a/sys/dev/ic/bwfm.c Fri Oct 20 22:29:33 2017 +0000
+++ b/sys/dev/ic/bwfm.c Fri Oct 20 23:38:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.1 2017/10/19 23:58:41 jmcneill Exp $ */
+/* $NetBSD: bwfm.c,v 1.2 2017/10/20 23:38:21 jmcneill Exp $ */
/* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -1573,7 +1573,17 @@
}
bss = &res->bss_info[0];
for (i = 0; i < le16toh(res->bss_count); i++) {
- bwfm_scan_node(sc, &res->bss_info[i], len);
+ /* Fix alignment of bss_info */
+ union {
+ struct bwfm_bss_info bss_info;
+ uint8_t padding[BWFM_BSS_INFO_BUFLEN];
+ } bss_buf;
+ if (len > sizeof(bss_buf)) {
+ printf("%s: bss_info buffer too big\n", DEVNAME(sc));
+ } else {
+ memcpy(&bss_buf, &res->bss_info[i], len);
+ bwfm_scan_node(sc, &bss_buf.bss_info, len);
+ }
len -= sizeof(*bss) + le32toh(bss->length);
bss = (void *)(((uintptr_t)bss) + le32toh(bss->length));
if (len <= 0)
Home |
Main Index |
Thread Index |
Old Index