tpu_window: Fix int16_t overflow in tpu_window calculation
authorHarald Welte <laforge@gnumonks.org>
Sat, 16 Jul 2011 16:01:48 +0000 (18:01 +0200)
committerHarald Welte <laforge@gnumonks.org>
Sat, 16 Jul 2011 16:01:48 +0000 (18:01 +0200)
commitd5c9c7362294761a7c103a4af688a6a367ac43dd
tree3ac75675061cd2a84bd5e5554598b9cf9fb764e9
parentc9297d28e0484f58b4672e528610b7ba9e5aa073
tpu_window: Fix int16_t overflow in tpu_window calculation

First we add 55500 to an int16_t, then later we subtract it again.
The bug only didn't become apparent as we wrap twice, once adding
then subtracting.

Discovered by Smatch:
firmware/layer1/tpu_window.c +127 l1s_rx_win_ctrl(24) warn: value 55000 can't fit into 32767 'stop'
src/target/firmware/layer1/tpu_window.c