Files
android_kernel_xiaomi_sm8450/include/uapi/linux
Chris Packham 9bbcdb07a5 tipc: Avoid copying bytes beyond the supplied data
TLV_SET is called with a data pointer and a len parameter that tells us
how many bytes are pointed to by data. When invoking memcpy() we need
to careful to only copy len bytes.

Previously we would copy TLV_LENGTH(len) bytes which would copy an extra
4 bytes past the end of the data pointer which newer GCC versions
complain about.

 In file included from test.c:17:
 In function 'TLV_SET',
     inlined from 'test' at test.c:186:5:
 /usr/include/linux/tipc_config.h:317:3:
 warning: 'memcpy' forming offset [33, 36] is out of the bounds [0, 32]
 of object 'bearer_name' with type 'char[32]' [-Warray-bounds]
     memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.c: In function 'test':
 test.c::161:10: note:
 'bearer_name' declared here
     char bearer_name[TIPC_MAX_BEARER_NAME];
          ^~~~~~~~~~~

We still want to ensure any padding bytes at the end are initialised, do
this with a explicit memset() rather than copy bytes past the end of
data. Apply the same logic to TCM_SET.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-20 20:16:08 -04:00
..
2019-01-28 08:13:52 +01:00
2019-04-24 09:46:34 -04:00
2019-04-15 18:14:01 -04:00
2019-03-07 18:32:01 -08:00
2019-01-24 11:11:42 -07:00
2019-02-14 11:51:51 -05:00
2018-12-20 19:13:07 +01:00
2019-03-27 13:30:07 -07:00
2018-06-18 15:11:53 +10:00
2018-09-13 10:46:24 +02:00
2018-09-05 22:27:11 -07:00
2018-07-07 17:41:38 +02:00
2018-08-03 10:03:57 -07:00
2017-11-28 16:54:00 +01:00
2018-12-19 09:40:13 +01:00
2018-04-11 10:28:37 -07:00
2018-12-16 12:15:25 -08:00
2018-12-01 12:38:32 +01:00
2018-01-14 23:06:30 -05:00
2018-01-16 16:47:29 +01:00
2019-05-13 18:34:48 -05:00
2019-01-22 10:21:45 +01:00
2018-03-20 03:17:41 +02:00
2018-04-14 11:59:31 -04:00
2017-11-24 10:18:41 +00:00
2019-05-07 14:31:03 +02:00
2017-11-16 10:49:00 +09:00
2018-04-11 10:28:37 -07:00
2019-03-23 21:50:05 -04:00
2019-02-14 11:51:51 -05:00
2018-09-03 13:29:38 +02:00
2018-02-06 18:32:44 -08:00
2016-12-16 00:13:32 +02:00