Bug 479842 - [PATCH] syswrap-linux: improve initialisation checks for I2C_RDWR syscall
Summary: [PATCH] syswrap-linux: improve initialisation checks for I2C_RDWR syscall
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.23 GIT
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-15 13:20 UTC by Christian Schmidt
Modified: 2024-01-31 15:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for improved initialisation checks for I2C_RDWR syscall (1.94 KB, patch)
2024-01-15 13:20 UTC, Christian Schmidt
Details

Note You need to log in before you can comment on or make changes to this bug.
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.