Bug in odmsign.func in secureboot_R32.6.1_aarch64.tbz

Hi there, there seems to be a bug in odmsign.func:odmsign_convert_part_image_type:673

line=`sed -n "/\"${part}\"/=" "${part_layout_file}"`
line=$(( line+7 ));

This looks for lines in the layout file matching the partition type (e.g. kernel), and sets line=. Where it goes wrong is if there are two partitions of the same type in the layout file. This occurs if a/b slots are enabled, so the layout file will have a “kernel” and a “kernel_b” entry in it. Both entries will have “type=kernel”, and both lines will be found and set by that sed command.

The problem is that:

line=$(( line+7 ));

then fails as (e.g.) line=522 534. This makes that: line=$(( 522 534 + 7 )) which is a syntax error. This should be updated to manage multiple entries in the layout file.

Also - Adding “7” to the location of the type line is a really fragile way of finding the filename line. And also there are hardcoded filenames in here somewhere that prevents layouts with different filename entries from being managed correctly… but that’s for a different post.

hello vincent.ting,

thanks for reporting this, I’ll arrange resources to check this internally.

Hi,
Looks like the function odmsign_convert_part_image_type() is not in use now. We will check and clean up some code.

If you hit any issue in running odmsign.func, please share the steps so that we can replicate the issue and check further.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.