DVB: negative internal->sub_range won't get noticed
Review
Quoted 5 lines · On Mon, 19 Jan 2009 00:35:47 +0100 Roel Kluin <[email protected]> wrote:
internal->sub_rangeis unsigned, a negative won't get noticed.Signed-off-by Roel Kluin <[email protected]>---
(quoted diff) +0
-0
b/drivers/media/dvb/frontends/stb0899_algo.c
drivers/media/dvb/frontends/stb0899_algo.c static void next_sub_range(struct
Quoted 4 lines
index 83dc7e1..2ea32da 100644
drivers/media/dvb/frontends/stb0899_algo.c +0
-0@@ -464,13 +464,14 @@ static void next_sub_range(struct
stb0899_state *state)
Quoted 18 lines
drivers/media/dvb/frontends/stb0899_algo.c +5
-4if (internal->sub_dir >0 ) { old_sub_range = internal->sub_range; - internal->sub_range =MIN ((internal->srch_range /2 ) - +if (internal->tuner_offst + internal->sub_range /2 >= + internal->srch_range /2 ) + internal->sub_range =0 ; +else + internal->sub_range =MIN ((internal->srch_range /2 ) - (internal->tuner_offst + internal->sub_range /2 ), internal->sub_range); -if (internal->sub_range <0 ) - internal->sub_range =0 ; - internal->tuner_offst += (old_sub_range + internal->sub_range) /2 ; }
Quoted 1 line
I hope someone understands that function :(
I guess the relevant people might. Sending it to wrong people and to a wrong mailing list, doesn't help much i guess.
That function does a step through a "next slice" of the RF carrier based on a RF center frequency, which is used for carrier acquisition.
Quoted 1 line
Do we actually need that test at all? Perhaps it has never
triggered?
Ranges can go negative, from the current offset to the left anything is negative, to the right it is positive. There of course is a bug that the variable is not signed.
I have pushed out a fix out here at
http://jusst.de/hg/v4l-dvb/rev/368dc6078295
including your comment on the macros. Thanks for pointing the bug.
Regards,
Manu