tbsdtv / linux_media

TBS linux open source drivers
https://github.com/tbsdtv/linux_media/wiki
Other
170 stars 79 forks source link

stid135_drv.c signed frequency_hz variable may overflow #181

Closed JianSun1 closed 3 years ago

JianSun1 commented 4 years ago

In this function and in this line if user wants to tune a specific range of freqency which is shown below may fail because of signed variable.

0x7FFFFFF<freq<2150MHz 

(Note: 0x7FFFFFFF is 2147483647 in decimals.) For instance, lets select a frequency value of 2148000000Hz, then it will be negative number and the calculations in this may fail;

si_register = ((frequency_hz/PLL_FVCO_FREQUENCY)*cfr_factor)/100

I am not sure if the next lines can handle this. I noticed that when i was looking into the code.

crazycat69 commented 4 years ago

frequency_hz=-550MHz..+650MHz