Skip to content

Commit 98691ac

Browse files
committed
Fixed coverity issue in acl_kernel_if.cpp: Type: Reliance on integer 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. However, since there is no checks on the return value determining whether or not the read/write was successful, I removed the read since a successful write implies a successful read.
1 parent 5994a1c commit 98691ac

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/acl_kernel_if.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,6 @@ static uintptr_t acl_kernel_cra_set_segment(acl_kernel_if *kern,
453453
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
454454
(unsigned int)segment);
455455
kern->cur_segment = segment;
456-
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
457-
(unsigned int *)&segment);
458456
}
459457

460458
return segment_offset;
@@ -470,8 +468,6 @@ static uintptr_t acl_kernel_cra_set_segment_rom(acl_kernel_if *kern,
470468
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
471469
(unsigned int)segment);
472470
kern->cur_segment = segment;
473-
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
474-
(unsigned int *)&segment);
475471
}
476472

477473
return segment_offset;
@@ -1615,8 +1611,6 @@ void acl_kernel_if_update_status(acl_kernel_if *kern) {
16151611
acl_kernel_if_write_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
16161612
(unsigned int)segment_pre_irq);
16171613
kern->cur_segment = segment_pre_irq;
1618-
acl_kernel_if_read_32b(kern, OFFSET_KERNEL_CRA_SEGMENT,
1619-
(unsigned int *)&segment_pre_irq);
16201614
}
16211615
}
16221616

0 commit comments

Comments
 (0)