Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2008 23:36:18 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135759 for review
Message-ID:  <200802192336.m1JNaIlb037534@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135759

Change 135759 by sam@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));
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802192336.m1JNaIlb037534>