There are two cases of UB that are fixed in this commit.
1. In ethercatmain.c, there are two left shifts of 31:
(1 << 31)
Because 1 is a signed int by default, the result cannot be represented
in an int. The fix is to explicitly make the 1 unsigned.
2. In ethercatconfig.c, for slaves that have no inputs, the code would
apply an offset to a NULL pointer. The fix is to test that the slave
has inputs available before applying the offset.
Both cases were found by clang with the help of UBSan.
* use uint8 for idx
* make config Isize/Osize uint32
* generally, align sizes in functions to HW objects
* Fix non-standard [0] size data array in EoE struct
Add one to the expected working counter per
ESC/Slave, not for every syncmanager/fmmu.
Use case, if the slave define more input/output
syncmanager/fmmus it still only generate maximum
working counter of 3 for a RW command.
fixes 374
This patch fixes some bugs on big-endian systems.
- Use temp variables for etohs() and etohl() at function calls to avoid
multiple function calls for one value.
- Fix and add use of etohs(), etohl(), htoes() and htoel().
- Fix use of 32bit values in 64bit variables.