diff options
| author | Karsten Keil <isdn@linux-pingi.de> | 2012-04-23 22:51:51 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-04-26 03:10:45 -0400 |
| commit | efef50a59f5536b94953838b05472eb490f6be09 (patch) | |
| tree | 355532b0888ff9f1227733dd3f979cde79af5cd3 | |
| parent | 52a637c2a5d96f12eadb17e03da9b3405cd58acf (diff) | |
mISDN: Fix division by zero
If DTMF debug is set and tresh goes under 100, the printk will cause
a division by zero.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/isdn/mISDN/dsp_dtmf.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/isdn/mISDN/dsp_dtmf.c b/drivers/isdn/mISDN/dsp_dtmf.c index 887860bdc63b..642f30be5ce2 100644 --- a/drivers/isdn/mISDN/dsp_dtmf.c +++ b/drivers/isdn/mISDN/dsp_dtmf.c | |||
| @@ -222,16 +222,25 @@ coefficients: | |||
| 222 | goto storedigit; | 222 | goto storedigit; |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) | 225 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) { |
| 226 | s32 tresh_100 = tresh/100; | ||
| 227 | |||
| 228 | if (tresh_100 == 0) { | ||
| 229 | tresh_100 = 1; | ||
| 230 | printk(KERN_DEBUG | ||
| 231 | "tresh(%d) too small set tresh/100 to 1\n", | ||
| 232 | tresh); | ||
| 233 | } | ||
| 226 | printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d" | 234 | printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d" |
| 227 | " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n", | 235 | " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n", |
| 228 | result[0] / 10000, result[1] / 10000, result[2] / 10000, | 236 | result[0] / 10000, result[1] / 10000, result[2] / 10000, |
| 229 | result[3] / 10000, result[4] / 10000, result[5] / 10000, | 237 | result[3] / 10000, result[4] / 10000, result[5] / 10000, |
| 230 | result[6] / 10000, result[7] / 10000, tresh / 10000, | 238 | result[6] / 10000, result[7] / 10000, tresh / 10000, |
| 231 | result[0] / (tresh / 100), result[1] / (tresh / 100), | 239 | result[0] / (tresh_100), result[1] / (tresh_100), |
| 232 | result[2] / (tresh / 100), result[3] / (tresh / 100), | 240 | result[2] / (tresh_100), result[3] / (tresh_100), |
| 233 | result[4] / (tresh / 100), result[5] / (tresh / 100), | 241 | result[4] / (tresh_100), result[5] / (tresh_100), |
| 234 | result[6] / (tresh / 100), result[7] / (tresh / 100)); | 242 | result[6] / (tresh_100), result[7] / (tresh_100)); |
| 243 | } | ||
| 235 | 244 | ||
| 236 | /* calc digit (lowgroup/highgroup) */ | 245 | /* calc digit (lowgroup/highgroup) */ |
| 237 | lowgroup = -1; | 246 | lowgroup = -1; |
