diff options
| author | bigbear <ns@bigbear.dk> | 2024-02-08 02:46:56 +0100 | 
|---|---|---|
| committer | bigbear <ns@bigbear.dk> | 2024-02-08 19:52:53 +0100 | 
| commit | 2c5076cc7ad141d8246626ab1a82e65f1c126d59 (patch) | |
| tree | a60afef0597c74964a2399c4c71a9caa5207ef34 /modules | |
| parent | eefbdc82d4f8c67f3e89782e6253da262edcf9c5 (diff) | |
FIX CodeQL warnings
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/devices/spd-decode.c | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c index 98095bd8..511504b2 100644 --- a/modules/devices/spd-decode.c +++ b/modules/devices/spd-decode.c @@ -123,13 +123,13 @@ static int parity(int value) {  }  static void decode_sdr_module_size(unsigned char *bytes, dmi_mem_size *size) { -    int i, k = 0; +    unsigned short i, k = 0;      i = (bytes[3] & 0x0f) + (bytes[4] & 0x0f) - 17;      if (bytes[5] <= 8 && bytes[17] <= 8) { k = bytes[5] * bytes[17]; }      if (i > 0 && i <= 12 && k > 0) { -        if (size) { *size = (1 << i) * k; } +      if (size) { *size = (dmi_mem_size)k * (unsigned short)(1 << i); }      } else {          if (size) { *size = -1; }      } @@ -333,13 +333,13 @@ static void decode_ddr_module_speed(unsigned char *bytes, float *ddrclk, int *pc  }  static void decode_ddr_module_size(unsigned char *bytes, dmi_mem_size *size) { -    int i, k; +    unsigned short i, k;      i = (bytes[3] & 0x0f) + (bytes[4] & 0x0f) - 17;      k = (bytes[5] <= 8 && bytes[17] <= 8) ? bytes[5] * bytes[17] : 0;      if (i > 0 && i <= 12 && k > 0) { -        if (size) { *size = (1 << i) * k; } +      if (size) { *size = (dmi_mem_size)k * (unsigned short)(1 << i); }      } else {          if (size) { *size = -1; }      } @@ -436,13 +436,13 @@ static void decode_ddr2_module_speed(unsigned char *bytes, float *ddr_clock, int  }  static void decode_ddr2_module_size(unsigned char *bytes, dmi_mem_size *size) { -    int i, k; +    unsigned short i, k;      i = (bytes[3] & 0x0f) + (bytes[4] & 0x0f) - 17;      k = ((bytes[5] & 0x7) + 1) * bytes[17];      if (i > 0 && i <= 12 && k > 0) { -        if (size) { *size = ((1 << i) * k); } +      if (size) { *size = (dmi_mem_size)k * (unsigned short)(1 << i); }      } else {          if (size) { *size = 0; }      } @@ -595,7 +595,7 @@ static void decode_ddr3_module_size(unsigned char *bytes, dmi_mem_size *size) {      unsigned int bus_width = 8 << (bytes[8] & 0x7);      unsigned int ranks = 1 + ((bytes[7] >> 3) & 0x7); -    *size = sdr_capacity / 8 * bus_width / sdr_width * ranks; +    *size = (dmi_mem_size)sdr_capacity / 8 * bus_width / sdr_width * ranks;  }  static void decode_ddr3_module_timings(unsigned char *bytes, float *trcd, float *trp, float *tras, @@ -855,7 +855,7 @@ static void decode_ddr4_module_size(unsigned char *bytes, dmi_mem_size *size) {      if (signal_loading == 2) lranks_per_dimm *= ((bytes[6] >> 4) & 7) + 1; -    *size = sdrcap / 8 * buswidth / sdrwidth * lranks_per_dimm; +    *size = (dmi_mem_size)sdrcap / 8 * buswidth / sdrwidth * lranks_per_dimm;  } | 
