diff options
author | Eric Biggers <ebiggers3@gmail.com> | 2016-01-25 03:08:52 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-02-11 11:07:08 +0100 |
commit | f97238373b8662a6d580e204df2e7bcbfa43e27a (patch) | |
tree | cfb079abd3a87ed329d9a4f68a5327f82de25f61 /drivers/base | |
parent | Linux 4.5-rc3 (diff) | |
download | linux-f97238373b8662a6d580e204df2e7bcbfa43e27a.tar.xz linux-f97238373b8662a6d580e204df2e7bcbfa43e27a.zip |
PM / sleep: declare __tracedata symbols as char[] rather than char
Accessing more than one byte from a symbol declared simply 'char' is undefined
behavior, as reported by UBSAN:
UBSAN: Undefined behaviour in drivers/base/power/trace.c:178:18
load of address ffffffff8203fc78 with insufficient space
for an object of type 'char'
Avoid this by declaring the symbols as arrays.
Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/trace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index a311cfa4c5bd..a6975795e7f3 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -166,14 +166,14 @@ void generate_pm_trace(const void *tracedata, unsigned int user) } EXPORT_SYMBOL(generate_pm_trace); -extern char __tracedata_start, __tracedata_end; +extern char __tracedata_start[], __tracedata_end[]; static int show_file_hash(unsigned int value) { int match; char *tracedata; match = 0; - for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; + for (tracedata = __tracedata_start ; tracedata < __tracedata_end ; tracedata += 2 + sizeof(unsigned long)) { unsigned short lineno = *(unsigned short *)tracedata; const char *file = *(const char **)(tracedata + 2); |