Bug 479842

Summary: [PATCH] syswrap-linux: improve initialisation checks for I2C_RDWR syscall
Product: [Developer tools] valgrind Reporter: Christian Schmidt <schmidt>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: pjfloyd
Priority: NOR    
Version: 3.23 GIT   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch for improved initialisation checks for I2C_RDWR syscall

Description Christian Schmidt 2024-01-15 13:20:12 UTC
Created attachment 164914 [details]
Patch for improved initialisation checks for I2C_RDWR syscall

The argument structures for this syscall contain padding. The current code will always fail, as the padding is not initialised.

The structures in question are from linux/i2c-dev.h:

struct i2c_rdwr_ioctl_data {
        struct i2c_msg *msgs;   /* pointers to i2c_msgs */
        __u32 nmsgs;                    /* number of i2c_msgs */
// Padding here (on 64bit machines)
};


and from linux/i2c.h:

struct i2c_msg {
        __u16 addr;
        __u16 flags;
        __u16 len;
// Padding here
        __u8 *buf;
};

Patch to check the individual fields instead is attached.