diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-17 19:51:07 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-17 19:51:07 +0100 |
commit | cfe20827fb78fe810e089e703dc96d70010ba798 (patch) | |
tree | 18d9460c139c2da228d46fe3fc81788589644f3a /drivers/thunderbolt | |
parent | 956ae8df7fed0a2acc7ae934f24493eaeb031f62 (diff) | |
parent | 3010518964dc96c41848a05a5b0ec11ccf8d5ebe (diff) | |
download | linux-cfe20827fb78fe810e089e703dc96d70010ba798.tar.bz2 |
Merge tag 'thunderbolt-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next
Mika writes:
thunderbolt: Changes for v5.7 merge window
- A couple of commits that make the driver to use flexible-array member
instead of zero-length array extension. This allows compiler to issue a
warning if the flexible array is not the last member of a structure.
- Use scnprintf() instead of snprintf() to avoid potential buffer
overflow.
* tag 'thunderbolt-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
thunderbolt: Use scnprintf() for avoiding potential buffer overflow
thunderbolt: icm: Replace zero-length array with flexible-array member
thunderbolt: eeprom: Replace zero-length array with flexible-array member
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r-- | drivers/thunderbolt/domain.c | 4 | ||||
-rw-r--r-- | drivers/thunderbolt/eeprom.c | 2 | ||||
-rw-r--r-- | drivers/thunderbolt/icm.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c index b7980c856898..68c1b93ac5d9 100644 --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c @@ -147,10 +147,10 @@ static ssize_t boot_acl_show(struct device *dev, struct device_attribute *attr, for (ret = 0, i = 0; i < tb->nboot_acl; i++) { if (!uuid_is_null(&uuids[i])) - ret += snprintf(buf + ret, PAGE_SIZE - ret, "%pUb", + ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%pUb", &uuids[i]); - ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s", + ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s", i < tb->nboot_acl - 1 ? "," : "\n"); } diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c index 921d164b3f35..b451a5aa90b5 100644 --- a/drivers/thunderbolt/eeprom.c +++ b/drivers/thunderbolt/eeprom.c @@ -247,7 +247,7 @@ struct tb_drom_entry_header { struct tb_drom_entry_generic { struct tb_drom_entry_header header; - u8 data[0]; + u8 data[]; } __packed; struct tb_drom_entry_port { diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c index 13e88109742e..fbbe32ca1e69 100644 --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c @@ -114,7 +114,7 @@ struct icm_notification { struct ep_name_entry { u8 len; u8 type; - u8 data[0]; + u8 data[]; }; #define EP_NAME_INTEL_VSS 0x10 |