The calculation uses 'char' to store a signed value.  But on some
platforms 'char' is unsigned, and the calculation yields bogus results.

Fixed by the diff below.

ok?


Index: dev/ipmi.c
===================================================================
RCS file: /cvs/src/sys/dev/ipmi.c,v
retrieving revision 1.107
diff -u -p -r1.107 ipmi.c
--- dev/ipmi.c  31 Dec 2019 10:05:32 -0000      1.107
+++ dev/ipmi.c  11 Jan 2020 18:30:24 -0000
@@ -1171,8 +1171,8 @@ signextend(unsigned long val, int bits)
 long
 ipmi_convert(u_int8_t v, struct sdrtype1 *s1, long adj)
 {
-       short   M, B;
-       char    K1, K2;
+       int16_t M, B;
+       int8_t  K1, K2;
        long    val;
 
        /* Calculate linear reading variables */

Reply via email to