Commit 83520d62 authored by dean.yang_cp's avatar dean.yang_cp Committed by Vineet Gupta

ARC: treewide: avoid the pointer addition with NULL pointer

Signed-off-by: default avatardean.yang_cp <yangdianqing@yulong.com>
Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 46e15218
...@@ -187,25 +187,26 @@ static void init_unwind_table(struct unwind_table *table, const char *name, ...@@ -187,25 +187,26 @@ static void init_unwind_table(struct unwind_table *table, const char *name,
const void *table_start, unsigned long table_size, const void *table_start, unsigned long table_size,
const u8 *header_start, unsigned long header_size) const u8 *header_start, unsigned long header_size)
{ {
const u8 *ptr = header_start + 4;
const u8 *end = header_start + header_size;
table->core.pc = (unsigned long)core_start; table->core.pc = (unsigned long)core_start;
table->core.range = core_size; table->core.range = core_size;
table->init.pc = (unsigned long)init_start; table->init.pc = (unsigned long)init_start;
table->init.range = init_size; table->init.range = init_size;
table->address = table_start; table->address = table_start;
table->size = table_size; table->size = table_size;
/* To avoid the pointer addition with NULL pointer.*/
/* See if the linker provided table looks valid. */ if (header_start != NULL) {
if (header_size <= 4 const u8 *ptr = header_start + 4;
|| header_start[0] != 1 const u8 *end = header_start + header_size;
|| (void *)read_pointer(&ptr, end, header_start[1]) != table_start /* See if the linker provided table looks valid. */
|| header_start[2] == DW_EH_PE_omit if (header_size <= 4
|| read_pointer(&ptr, end, header_start[2]) <= 0 || header_start[0] != 1
|| header_start[3] == DW_EH_PE_omit) || (void *)read_pointer(&ptr, end, header_start[1])
header_start = NULL; != table_start
|| header_start[2] == DW_EH_PE_omit
|| read_pointer(&ptr, end, header_start[2]) <= 0
|| header_start[3] == DW_EH_PE_omit)
header_start = NULL;
}
table->hdrsz = header_size; table->hdrsz = header_size;
smp_wmb(); smp_wmb();
table->header = header_start; table->header = header_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment