Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST DNM] Test 8216 #8234

Closed
wants to merge 20 commits into from
Closed

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Sep 20, 2023

Zero conflict when stacked on top of #8233

marc-hb and others added 20 commits September 20, 2023 05:23
Open /sys/kernel/debug/sof/fw_version _after_
/sys/kernel/debug/sof/[e]trace because reading the former is optional
and the latter is not.

So when the driver is not loaded, we get the same (missing trace) error
trace message whether we use the -n option or not.

Signed-off-by: Marc Herbert <[email protected]>
(cherry picked from commit af6bd41)
Don't fail immediately when the driver is not loaded. Use inotify
instead to wait for /sys/kernel/debug/sof/[e]trace to appear.

This makes it possible to start before the driver is loaded which
reduces considerably the chances of missing early logs.

Fixes a small part of thesofproject/linux#3275

Signed-off-by: Marc Herbert <[email protected]>
(cherry picked from commit dcf0577)
Restores ability to compile on Windows with MSYS.

Fixes commit dcf0577 ("logger: allow starting before the driver is
loaded")

Signed-off-by: Marc Herbert <[email protected]>
(cherry picked from commit 92d828b)
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after malloc.

Signed-off-by: Kai Vehmanen <[email protected]>
(cherry picked from commit 4d64893)
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after calloc.

Signed-off-by: Kai Vehmanen <[email protected]>
(cherry picked from commit 4bec5b2)
sof-logger -u 115200 -d /lib/firmware/sof-foo.ldc

Leads to silent failure as a NULL is passed to open(). Add
explicit error handling for this case.

Signed-off-by: Kai Vehmanen <[email protected]>
(cherry picked from commit 80adcdf)
Finish the job that commit 5b29dae ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
finish, leaving behind a supposedly "global" variable that is actually a
confusing global pointer to a struct local to the main() function.

This confuses some static analyzer complaining that stack values are
being returned, see thesofproject#6858 and thesofproject#6738. This is a false positive
because the main()'s stack lifespan is the same as a global but let's
simplify things anyway.

Also stop using 'extern' in .c files, use a proper .h file instead.

Signed-off-by: Marc Herbert <[email protected]>
(cherry picked from commit 327a26b)
Finish the job that commit 5b29dae ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
complete, leaving a confusing mix of globals and locals.

This confuses some static analyzer complaining that stack values are
being returned, see thesofproject#6858 and thesofproject#6738. This is a false positive because
convert's() stack lifespan is practically the same as a global but let's
simplify things anyway.

Signed-off-by: Marc Herbert <[email protected]>
(cherry picked from commit 2dfaee6)
localtime() can return NULL in error cases. Check the return value
before dereferencing it.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
(cherry picked from commit 84b2dd2)
Due to allocation failures, or invalid content in dictionary,
"params" entries in "struct proc_ldc_entry" may be NULL.

In print_entry_params(), the NULL entries may be passed
as arguments to fprintf(). While e.g. glibc handles these without
error, this is not guaranteed behaviour and may result in segfault
on some platforms.

Fix the issue by aborting program if allocation fails and
explicitly handling the cases when asprintf_entry_text returns
NULL.

Signed-off-by: Kai Vehmanen <[email protected]>
(cherry picked from commit 1a7a36a)
The values assigned when declaring variables were overwritten in the code.
Redundant initialization was removed.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 74d093b)
Added checking of the value returned by fseek function and added memory
release when an error is detected.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 36448d0)
String terminator was added to the buffer with a list of section names
in the elf file. Added check to the section name index to make sure it
doesn't go beyond the buffer size.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 5b837af)
The clock_gettime function only returns information that an error occurred.
The error code should be taken from the errno variable.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit a119fad)
Added checking of value returned by file operation functions. In case of an
error, message is printed and error code is returned.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit b83a50e)
The timestamp printing process has been simplified by eliminating the
dynamic creation of the formatting string. All necessary parameters are now
passed directly to the printing function.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 8516f1d)
…inated

Added a null string terminator to be sure that strings read from a file are
terminated correctly.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit b0b79f1)
The precision check condition has been simplified, the unsigned value
cannot be negative. Added definitions containing an error message instead
of using a constant variable.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 1951b8d)
Used string manipulation functions that check the size of the available
buffer.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 50f936d)
Improved release of resources when an error is detected.

Signed-off-by: Adrian Warecki <[email protected]>
(cherry picked from commit 636bd70)
@marc-hb
Copy link
Collaborator Author

marc-hb commented Sep 27, 2023

Superseded by #8271

@marc-hb marc-hb closed this Sep 27, 2023
@marc-hb marc-hb deleted the test-8216 branch September 27, 2023 21:22
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.

4 participants