Skip to content

Commit

Permalink
Fixed coverity issue in acl_kernel_if.cpp: Type: Reliance on integer …
Browse files Browse the repository at this point in the history
…endianness (INCOMPATIBLE_CAST)

In the three instances where this issue happens, the function acl_kernel_if_read_32b is used at the end of the scope to query about what's inside the acl_kernel_if* kern object. However, they don't do anything with the obtained information. I believe this read operation is performed to confirm that the acl_kernel_if* kern has been written properly. So if the read operation successed, then the write operation must have also succeeded as well. The functions employing acl_kernel_if_read_32b are used to return the segment offset. This segment offset is then used to perform another read/write, which return status would then be used for error checking. Therefore, the `acl_kernel_if_read_32b` function is redundant and can be removed from the aformentioned 3 instances.
  • Loading branch information
haoxian2 committed Jan 23, 2023
1 parent 2425af6 commit acc86b9
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/acl_kernel_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ static uintptr_t acl_kernel_cra_set_segment(acl_kernel_if *kern,
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int)segment);
kern->cur_segment = segment;
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int *)&segment);
}

return segment_offset;
Expand All @@ -470,8 +468,6 @@ static uintptr_t acl_kernel_cra_set_segment_rom(acl_kernel_if *kern,
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int)segment);
kern->cur_segment = segment;
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int *)&segment);
}

return segment_offset;
Expand Down Expand Up @@ -1613,8 +1609,6 @@ void acl_kernel_if_update_status(acl_kernel_if *kern) {
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int)segment_pre_irq);
kern->cur_segment = segment_pre_irq;
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
(unsigned int *)&segment_pre_irq);
}
}

Expand Down

0 comments on commit acc86b9

Please # to comment.