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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAl5wdFcgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBfbg/8CKZxEIh7Qms5
 CBuHU689e0sEwN/vRiAgBspiKJTDUk5lZRl0wDFun1+2DV3AGrExJj07k//xG9Zw
 on9ma1TKufkZsuy2yllAb70fE8SdhZ3ZUIqrFvCGj2g5NwRWZvFE0L47zM5Wi+wt
 y5k1ifJUrgVCliZjgKDg7EXXP7InLBFtT89yL9LaQ71to+tp2PI5EDN/1JGOnDUV
 3c/WPqw0bPmQbW/E8CT9vU+Jd3Jh6bEHKJqXTZwj6bLGWP0aiegPzk2/04m7rG3A
 kq7hrwubOEVSsZogRRuZEbiNKX5jMwCPUGvd6qC2kZnKJxanEu/syOSt+yBhE2NW
 f2D7WBdCAtxCh8AiMAJDcLphvpY/LrXk2+i710kaSH/Xfl4D5z6QTbsQ0jTx9FIs
 O08rYuikd0lxd/Zr2+qEbCna2UEjTarxEInyKKYm04H8HFycm3OtAN6pzm+O11W7
 LFJebmTFounwvOknRx+30k1X3ylperMZhhDRXg6J2gh1y2Dxy2EgnFY/mX0IivwD
 7PHIgvD34I2RpgIrUYNa/R9TDuKDGsA2FnEYL9XBU+f7VWwam0U+Zw088NpMUMsB
 8b/hFhgyeds1FRwCdrepM+UT5xwsykIycUZaV/g6KwXaNCYjygTFGPCHI4+cjLBe
 MNA31gcVUu62ya4vgUUL2Kz5vt3TrLw=
 =/p8i
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Greg Kroah-Hartman 2020-03-17 19:51:07 +01:00
Родитель 956ae8df7f 3010518964
Коммит cfe20827fb
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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");
}

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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