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.