[svn-commits] sruffell: linux/trunk r9368 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Sep 20 15:33:35 CDT 2010
Author: sruffell
Date: Mon Sep 20 15:33:31 2010
New Revision: 9368
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9368
Log:
dahdi: Reduce chans array indexing in dahdi_chan_unreg.
Review: https://reviewboard.asterisk.org/r/905/
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9368&r1=9367&r2=9368
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Sep 20 15:33:31 2010
@@ -2042,29 +2042,32 @@
}
#endif
maxchans = 0;
- for (x=1;x<DAHDI_MAX_CHANNELS;x++)
- if (chans[x]) {
- maxchans = x + 1;
- /* Remove anyone pointing to us as master
- and make them their own thing */
- if (chans[x]->master == chan) {
- chans[x]->master = chans[x];
+ for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
+ struct dahdi_chan *const pos = chans[x];
+ if (!pos)
+ continue;
+ maxchans = x + 1;
+ /* Remove anyone pointing to us as master
+ and make them their own thing */
+ if (pos->master == chan)
+ pos->master = pos;
+
+ if ((pos->confna == chan->channo) &&
+ is_monitor_mode(pos->confmode) &&
+ ((pos->confmode & DAHDI_CONF_MODE_MASK) ==
+ DAHDI_CONF_DIGITALMON)) {
+ /* Take them out of conference with us */
+ /* release conference resource if any */
+ if (pos->confna) {
+ dahdi_check_conf(pos->confna);
+ if (pos->span)
+ dahdi_disable_dacs(pos);
}
- if ((chans[x]->confna == chan->channo) &&
- is_monitor_mode(chans[x]->confmode) &&
- ((chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_DIGITALMON)) {
- /* Take them out of conference with us */
- /* release conference resource if any */
- if (chans[x]->confna) {
- dahdi_check_conf(chans[x]->confna);
- if (chans[x]->span)
- dahdi_disable_dacs(chans[x]);
- }
- chans[x]->confna = 0;
- chans[x]->_confn = 0;
- chans[x]->confmode = 0;
- }
- }
+ pos->confna = 0;
+ pos->_confn = 0;
+ pos->confmode = 0;
+ }
+ }
chan->channo = -1;
write_unlock_irqrestore(&chan_lock, flags);
}
More information about the svn-commits
mailing list