-
Notifications
You must be signed in to change notification settings - Fork 349
[SOF2.4] Backport fixes PR6848, PR6858 and PR6862 #6871
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
Merged
lgirdwood
merged 8 commits into
thesofproject:stable-v2.4
from
kv2019i:202212-sof24-backport-dec21b
Dec 21, 2022
Merged
[SOF2.4] Backport fixes PR6848, PR6858 and PR6862 #6871
lgirdwood
merged 8 commits into
thesofproject:stable-v2.4
from
kv2019i:202212-sof24-backport-dec21b
Dec 21, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <marc.herbert@intel.com> (cherry picked from commit 327a26b) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
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 <marc.herbert@intel.com> (cherry picked from commit 2dfaee6) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Fix a case of a possible array overflow, detected by static code analysis. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> (cherry picked from commit 0b295eb) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Make sure there's at least one channel in the volume configuration. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> (cherry picked from commit 24062b4) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Check source and sink channels to avoid accessing beyond array boundaries. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> (cherry picked from commit d5e9794) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
localtime() can return NULL in error cases. Check the return value before dereferencing it. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> (cherry picked from commit 84b2dd2) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
With IPC4 only two 32-bit values are copied from the host in the common part, anything beyond that must be copied separately. Those two values are stored in a global msg_data.msg_in object. Therefore always when reading from it only up to 8 bytes should be read. In most cases it is also the case, because the target object has the same size, but in case of SOF_IPC4_MOD_INIT_INSTANCE this isn't the case, there special care must be taken. Also remove a redundant NULL check where NULL cannot appear. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> (cherry picked from commit 96686cf) Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
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 <kai.vehmanen@linux.intel.com> (cherry picked from commit 1a7a36a)
lgirdwood
approved these changes
Dec 21, 2022
lyakh
approved these changes
Dec 21, 2022
ujfalusi
reviewed
Dec 21, 2022
| int ret; | ||
|
|
||
| memcpy_s(&cdma, sizeof(cdma), ipc4, sizeof(cdma)); | ||
| memcpy_s(&cdma, sizeof(cdma), ipc4, sizeof(*ipc4)); |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just obfuscation of what we do...
cdma.primary.dat = ipc4->primary.dat;
cdma.extension.dat = ipc4->extension.dat;is done here or the ipc4 point to be re-casted to chain dma struct:
struct ipc4_chain_dma *cdma = (struct ipc4_chain_dma *) ipc4;it could be safer to have a local copy, but I don't think it matter, using the same memory is fine here.
abonislawski
approved these changes
Dec 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport following PRs from main (total 8 commits)