Skip to content

For linux msm/device programmer selection test#206

Open
andersson wants to merge 2 commits intolinux-msm:masterfrom
quic-bjorande:for-linux-msm/device-programmer-selection-test
Open

For linux msm/device programmer selection test#206
andersson wants to merge 2 commits intolinux-msm:masterfrom
quic-bjorande:for-linux-msm/device-programmer-selection-test

Conversation

@andersson
Copy link
Copy Markdown
Collaborator

No description provided.

An empty image_path in a Sahara configuration file results in a NULL
pointer dereference, guard against this to provide a more helpful
outcome.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
What used to be a simple process of picking the one file has now become
a complicated machinery. Introduce a test suite to ensure the various
cases remain functional.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
#
# Clean up
#
rm -f 13a:prog_A.elf \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file created before is (seems a type, 13a:14prog_A.elf):

cp prog_firehose_ddr.elf 13a:14prog_A.elf || true

mk_fixture_sahara "sahara-windows.xml" "13:c:\\prog_D.elf"
mk_fixture_sahara "sahara-non-exist.xml" "999:nonexisting-programmer.elf"
mk_fixture_sahara "sahara-empty-path.xml" "13:"
mk_fixture_sahara "sahara-absolute-path.xml" "13:$(readlink -f prog_A.elf)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixture is created and cleaned up, but seems there's no assert_programmer call for it.

echo "Expected:"
echo "$expected"
echo "Got:"
#echo "$out"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we echo this conditionally based on some env variable (DEBUG?)

image_path = attr_as_string(image_node, "image_path", &errors);

if (image_id == 0 || image_id >= MAPPING_SZ || errors) {
if (image_id == 0 || image_id >= MAPPING_SZ || !image_path || errors) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!image_path catches NULL, but the test fixture for sahara-empty-path.xml is created with image_path="" , so attr_as_string will return strdup(""), so !image_path is false and the empty path slips through. Can we check both?

|| !image_path || !*image_path ||

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants