diff --git a/packages/addons/addon-depends/system-tools-depends/i2c-tools/package.mk b/packages/addons/addon-depends/system-tools-depends/i2c-tools/package.mk index 06cfbdf9cb..a62c545c45 100644 --- a/packages/addons/addon-depends/system-tools-depends/i2c-tools/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/i2c-tools/package.mk @@ -3,10 +3,10 @@ PKG_NAME="i2c-tools" PKG_VERSION="3.1.2" -PKG_SHA256="f939a6242c03950cc568d0efdfa3db7a9c29e0e8f5abd01f2908bdd344c054ff" +PKG_SHA256="6d6079153cd49a62d4addacef4c092db1a46ba60b2807070a3fbe050262aef87" PKG_LICENSE="GPL" -PKG_SITE="http://www.lm-sensors.org/wiki/I2CTools" -PKG_URL="http://fossies.org/linux/misc/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://i2c.wiki.kernel.org/index.php/I2C_Tools" +PKG_URL="https://www.kernel.org/pub/software/utils/i2c-tools/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain Python3 distutilscross:host" PKG_LONGDESC="A heterogeneous set of I2C tools for Linux." PKG_BUILD_FLAGS="-sysroot" diff --git a/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/decode-dimms_Correctly-check-for-out-of-bounds-vendor-ID.patch b/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/decode-dimms_Correctly-check-for-out-of-bounds-vendor-ID.patch new file mode 100644 index 0000000000..8899135587 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/decode-dimms_Correctly-check-for-out-of-bounds-vendor-ID.patch @@ -0,0 +1,46 @@ +From 2b4135907c1aa27edeb397e62b67386ff5d7d3d5 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Thu, 23 Jun 2016 18:59:07 +0200 +Subject: decode-dimms: Correctly check for out-of-bounds vendor ID + +--- + CHANGES | 3 +++ + eeprom/decode-dimms | 8 +++++--- + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/CHANGES b/CHANGES +index 69f9853..9d0acd7 100644 +--- a/CHANGES ++++ b/CHANGES +@@ -1,6 +1,9 @@ + i2c-tools CHANGES + ----------------- + ++3.1.3 (work in progress) ++ decode-dimms: Correctly check for out-of-bounds vendor ID ++ + 3.1.2 (2015-06-17) + decode-dimms: Fix DDR3 extended temp range refresh rate decoding + py-smbus: Add support for python 3 +diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms +index a088ba0..4a15fd7 100755 +--- a/eeprom/decode-dimms ++++ b/eeprom/decode-dimms +@@ -343,9 +343,11 @@ sub manufacturer_ddr3($$) + { + my ($count, $code) = @_; + return "Invalid" if parity($count) != 1; +- return "Invalid" if parity($code) != 1; +- return (($code & 0x7F) - 1 > $vendors[$count & 0x7F]) ? "Unknown" : +- $vendors[$count & 0x7F][($code & 0x7F) - 1]; ++ return "Invalid" if parity($code) != 1 ++ or ($code & 0x7F) == 0; ++ return "Unknown" if ($count & 0x7F) >= @vendors ++ or ($code & 0x7F) - 1 >= @{$vendors[$count & 0x7F]}; ++ return $vendors[$count & 0x7F][($code & 0x7F) - 1]; + } + + sub manufacturer(@) +-- +cgit 1.2.3-1.el7 + diff --git a/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/i2cset_Fix-short-writes-with-mask.patch b/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/i2cset_Fix-short-writes-with-mask.patch new file mode 100644 index 0000000000..7847858bd1 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/i2c-tools/patches/i2cset_Fix-short-writes-with-mask.patch @@ -0,0 +1,98 @@ +From 11a1738e83bbb093f22e38ad11ba9f0e73ae9248 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 8 Sep 2020 17:22:33 +0200 +Subject: i2cset: Fix short writes with mask + +Short writes used "daddress" for the value, but the masking code did +not expect that, and instead applied the mask to a variable that was +never used. + +So change short writes to use "value" for the value, as all other +commands do. Adjust all code paths accordingly. + +Reported by David Jedynak. + +Signed-off-by: Jean Delvare +Reviewed-by: Wolfram Sang +Tested-by: Wolfram Sang +--- + CHANGES | 1 + + tools/i2cset.c | 25 +++++++++++++------------ + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/tools/i2cset.c b/tools/i2cset.c +index e143b65..84925d2 100644 +--- a/tools/i2cset.c ++++ b/tools/i2cset.c +@@ -123,11 +123,11 @@ static int confirm(const char *filename, int address, int size, int daddress, + } + + fprintf(stderr, "I will write to device file %s, chip address " +- "0x%02x, data address\n0x%02x, ", filename, address, daddress); +- if (size == I2C_SMBUS_BYTE) +- fprintf(stderr, "no data.\n"); +- else if (size == I2C_SMBUS_BLOCK_DATA || +- size == I2C_SMBUS_I2C_BLOCK_DATA) { ++ "0x%02x,\n", filename, address); ++ if (size != I2C_SMBUS_BYTE) ++ fprintf(stderr, "data address 0x%02x, ", daddress); ++ if (size == I2C_SMBUS_BLOCK_DATA || ++ size == I2C_SMBUS_I2C_BLOCK_DATA) { + int i; + + fprintf(stderr, "data"); +@@ -138,7 +138,7 @@ static int confirm(const char *filename, int address, int size, int daddress, + } else + fprintf(stderr, "data 0x%02x%s, mode %s.\n", value, + vmask ? " (masked)" : "", +- size == I2C_SMBUS_BYTE_DATA ? "byte" : "word"); ++ size == I2C_SMBUS_WORD_DATA ? "word" : "byte"); + if (pec) + fprintf(stderr, "PEC checking enabled.\n"); + +@@ -261,6 +261,10 @@ int main(int argc, char *argv[]) + + /* read values from command line */ + switch (size) { ++ case I2C_SMBUS_BYTE: ++ /* short write: data address was not really data address */ ++ value = daddress; ++ break; + case I2C_SMBUS_BYTE_DATA: + case I2C_SMBUS_WORD_DATA: + value = strtol(argv[flags+4], &end, 0); +@@ -341,12 +345,10 @@ int main(int argc, char *argv[]) + + if (!yes) { + fprintf(stderr, "Old value 0x%0*x, write mask " +- "0x%0*x: Will write 0x%0*x to register " +- "0x%02x\n", ++ "0x%0*x, will write 0x%0*x\n", + size == I2C_SMBUS_WORD_DATA ? 4 : 2, oldvalue, + size == I2C_SMBUS_WORD_DATA ? 4 : 2, vmask, +- size == I2C_SMBUS_WORD_DATA ? 4 : 2, value, +- daddress); ++ size == I2C_SMBUS_WORD_DATA ? 4 : 2, value); + + fprintf(stderr, "Continue? [Y/n] "); + fflush(stderr); +@@ -366,7 +368,7 @@ int main(int argc, char *argv[]) + + switch (size) { + case I2C_SMBUS_BYTE: +- res = i2c_smbus_write_byte(file, daddress); ++ res = i2c_smbus_write_byte(file, value); + break; + case I2C_SMBUS_WORD_DATA: + res = i2c_smbus_write_word_data(file, daddress, value); +@@ -404,7 +406,6 @@ int main(int argc, char *argv[]) + switch (size) { + case I2C_SMBUS_BYTE: + res = i2c_smbus_read_byte(file); +- value = daddress; + break; + case I2C_SMBUS_WORD_DATA: + res = i2c_smbus_read_word_data(file, daddress); +-- +cgit 1.2.3-1.el7 +