Re: bitpos expansion patches summary

Jan Kratochvil
2012-08-19T16:42:19Z

Hi Siddhesh,

another part of the review.

Thanks,
Jan

RSAFE: (dwarf2loc.c:2257): FUNC(memcpy): (ULONGEST to size_t) [n]
SAFE(value_contents_raw ensures size_t): (dwarf2loc.c:2277): CMP: (ULONGEST to size_t) [n > (type)->length]
SAFE(value_contents_raw ensures size_t): (dwarf2loc.c:2283): ASSIGN: (ULONGEST to size_t) [ n = (type)->length]
RSAFE: (dwarf2read.c:7340): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
FIXED(Expand bit_offset): (dwarf2read.c:9847): VARINIT(bit_offset): (ULONGEST to int) [((attr)->u.unsnd)]
SAFE(Pointer Type): (dwarf2read.c:11298): CMP: (int to ULONGEST) [(type)->length != byte_size]
SAFE(Pointer Type): (dwarf2read.c:11310): CMP: (int to ULONGEST) [(type)->length != byte_size]
SAFE: (dwarf2read.c:11376): ASSIGN: (UCHAR to ULONGEST) [ (type)->length = cu_header->addr_size]
SAFE: (dwarf2read.c:11888): CMP: (int to ULONGEST) [(int_type)->length >= addr_size]
SAFE: (dwarf2read.c:11893): CMP: (int to ULONGEST) [(int_type)->length >= addr_size]
SAFE: (dwarf2read.c:11898): CMP: (int to ULONGEST) [(int_type)->length >= addr_size]
SAFE: (dwarf2read.c:15218): CMP: (UCHAR to ULONGEST) [(type)->length != cu_header->addr_size]
SAFE: (dwarf2read.c:15220): FUNC(dwarf2_const_value_length_mismatch_complaint): (UCHAR to LONGEST) [cu_header->addr_size]
SAFE: (dwarf2read.c:15254): CMP: (size_t to ULONGEST) [(type)->length != blk->size]
SAFE: (elfread.c:628): VARINIT(ptr_size): (ULONGEST to size_t) [(ptr_type)->length]
SAFE: (elfread.c:869): VARINIT(ptr_size): (ULONGEST to size_t) [(ptr_type)->length]
RSAFE: (eval.c:446): FUNC(memcpy): (ULONGEST to size_t) [(value_type(val))->length]
RSAFE: (eval.c:489): FUNC(memcpy): (LONGEST to size_t) [element_size]
RSAFE: (eval.c:498): FUNC(memcpy): (LONGEST to size_t) [element_size]
SAFE: (eval.c:611): CMP: (int to ULONGEST) [(type1)->length * 8 > gdbarch_double_bit(gdbarch)]
SAFE: (eval.c:612): CMP: (int to ULONGEST) [(type2)->length * 8 > gdbarch_double_bit(gdbarch)]
SAFE: (eval.c:715): CMP: (int to ULONGEST) [result_len > gdbarch_long_bit(gdbarch) / 8]
SAFE: (eval.c:722): CMP: (int to ULONGEST) [result_len > gdbarch_long_bit(gdbarch) / 8]
RSAFE: (eval.c:996): FUNC(memset): (ULONGEST to size_t) [(type)->length]
RSAFE: (eval.c:1015): FUNC(memset): (ULONGEST to size_t) [(expect_type)->length]
RSAFE: (eval.c:1046): FUNC(memcpy): (LONGEST to size_t) [element_size]
RSAFE: (eval.c:1069): FUNC(memset): (ULONGEST to size_t) [(type)->length]
SEPARATE(Ensure that the value fits into CORE_ADDR): (eval.c:2075): FUNC(value_from_pointer): (LONGEST to CORE_ADDR) [value_as_long(arg1) + mem_offset]
- I do not understand this, you have correctly made 'long->LONGEST mem_offset;', I find it enough.
SAFE: (findcmd.c:184): CMP: (size_t to LONGEST) [(val_bytes) > (sizeof(int64_t))]
- (new entry) I miss here findcmd.c:190 fix, xrealloc
ULONGEST pattern_buf_size;
pattern_buf = xrealloc (pattern_buf, pattern_buf_size);
That second xrealloc parameter may overflow, there should be ENSURED_SIZET.
ENSURED_SIZET: (findcmd.c:218): FUNC(memcpy): (LONGEST to size_t) [val_bytes]
- Not needed, there is already called 'value_contents (v)'.
RSAFE: (findvar.c:493): FUNC(memcpy): (LONGEST to size_t) [len]
RSAFE: (frame.c:872): FUNC(memcpy): (ULONGEST to size_t) [(value_type(value))->length]
RSAFE: (frame.c:874): FUNC(memset): (ULONGEST to size_t) [(value_type(value))->length]
UNRELATED(Expand return value): (f-valprint.c:85): RET: (LONGEST to int) [((((((type))->main_type->flds_bnds.fields[0]).type))->main_type->flds_bnds.bounds->high)]
- I agree unrelated but when found it should be fixed in a separate patch.
FIXED(Expand i): (f-valprint.c:178): CMP: (LONGEST to int) [i < (f77_array_offset_tbl[nss][1])]
FIXED(Expand i): (f-valprint.c:189): CMP: (LONGEST to int) [i < (f77_array_offset_tbl[nss][1])]
FIXED(Expand i): (f-valprint.c:194): CMP: (LONGEST to int) [i < (f77_array_offset_tbl[nss][1])]
FIXED(Expand i): (f-valprint.c:203): CMP: (LONGEST to int) [i != ((f77_array_offset_tbl[nss][1]) - 1)]
FIXED(Expand i): (f-valprint.c:207): CMP: (LONGEST to int) [i != ((f77_array_offset_tbl[nss][1]) - 1)]
SAFE: (gdbtypes.c:841): CMP: (size_t to ULONGEST) [(type)->length > sizeof(LONGEST)]
SAFE: (gdbtypes.c:3718): ASSIGN: (LONGEST to int) [ left = (((f[0]).loc.bitpos) + 0) % alignment]
FIXED(Expand embedded_offset): (go-valprint.c:107): FUNC(print_go_string): (LONGEST to int) [embedded_offset]
- But print_go_string does not have embedded_offset expanded - failure of splint re-run.
UNSAFE_ALLOCA: (h8300-tdep.c:675): FUNC(C_alloca): (LONGEST to size_t) [padded_len]
- There should be alloca fix again with xmalloc and cleanup.
ENSURED_SIZET: (h8300-tdep.c:677): FUNC(memset): (LONGEST to size_t) [padded_len]
- This is redundant, there is already above it:
char *contents = (char *) value_contents (args[argument]);
ENSURED_SIZET: (h8300-tdep.c:679): FUNC(memcpy): (LONGEST to size_t) [len]
ENSURED_SIZET: (h8300-tdep.c:689): FUNC(write_memory): (LONGEST to ssize_t) [padded_len]
ENSURED_SIZET: (h8300-tdep.c:716): FUNC(write_memory): (LONGEST to ssize_t) [padded_len]
FIXED(Expand len): (h8300-tdep.c:747): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Likewise): (h8300-tdep.c:784): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Likewise): (h8300-tdep.c:851): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Likewise): (h8300-tdep.c:881): VARINIT(len): (ULONGEST to int) [(type)->length]
ENSURED_SIZET: (h8300-tdep.c:928): FUNC(read_memory): (ULONGEST to ssize_t) [(type)->length]
- Redundant, caller must have provided large enough READBUF.