On Tue, May 13, 2025 at 05:35:39PM +0200, Jean Delvare wrote: > Valgrind complains that uninitialized memory may be passed to > ioctl(): > > == Syscall param ioctl(I2C_RDWR) points to uninitialised byte(s) > == at 0x499382B: ioctl (in /lib64/libc.so.6) > == by 0x401957: main (i2ctransfer.c:343) > == Address 0x1ffefff94c is on thread 1's stack > == in frame #1, created by main (i2ctransfer.c:144) > == > == Syscall param ioctl(I2C_RDWR).msgs points to uninitialised byte(s) > == at 0x499382B: ioctl (in /lib64/libc.so.6) > == by 0x401957: main (i2ctransfer.c:343) > == Address 0x1ffefff956 is on thread 1's stack > == in frame #1, created by main (i2ctransfer.c:144) > > Zero out the i2c_rdwr_ioctl_data struct as well as the msgs array to > guarantee that no uninitialized memory will ever be passed to the > kernel. > > Signed-off-by: Jean Delvare Applied, thanks! > This one is not strictly needed, I can't see any actual bug. However > making valgrind happy seems to be a sane goal, so that we can keep > using it when debugging other issues without getting distracted. > Wolfram, what do you think? Sure, I agree. Also, I like the simpler code.