PERFORCE change 135759 for review

Sam Leffler sam at FreeBSD.org
Tue Feb 19 23:36:19 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=135759

Change 135759 by sam at sam_ebb on 2008/02/19 23:35:51

	sort_channels expects there are channels; avoid calling it
	with an empty table

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_regdomain.c#7 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_regdomain.c#7 (text+ko) ====

@@ -172,6 +172,7 @@
 	uint8_t *aa = a;
 	uint8_t *ai, *t;
 
+	KASSERT(n > 0, ("no channels"));
 	for (ai = aa+size; --n >= 1; ai += size)
 		for (t = ai; t > aa; t -= size) {
 			uint8_t *u = t - size;
@@ -191,7 +192,8 @@
 void
 ieee80211_sort_channels(struct ieee80211_channel chans[], int nchans)
 {
-	sort_channels(chans, nchans, sizeof(struct ieee80211_channel));
+	if (nchans > 0)
+		sort_channels(chans, nchans, sizeof(struct ieee80211_channel));
 }
 
 /*


More information about the p4-projects mailing list