presumed bug in magnitude code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone.

I think I have located a potential bug in the magnitude code. If you
take a look at lm_sensors2/lib/proc.c, in sensors_read_proc and
sensors_write_proc, you'll see:

  for (mag = the_feature->scaling; mag > 0; mag --)
    value *= 10.0;
  for (; mag < 0; mag --)
    value /= 10.0;

It looks obvious to me that any negative magnitude would result in a
crash. It's "mag ++" on the third line, right? We never caught it
because we never had negative magnitudes, but should it happen someday,
I better commit a fix right now.

-- 
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux