On Wed, Oct 30, 2024 at 09:27:05PM +0530, Suraj Sonawane wrote: > These errors occurred because the variable 'be_rate' is declared but > may not be assigned a value before it is used. Specifically, if the > loop that assigns values to 'be_rate' does not execute (for example, > when 'num_input_formats' is zero), 'be_rate' remains uninitialized, > leading to potential undefined behavior. > > To resolve this issue, initialize 'be_rate' to 0 at the point of > declaration. This ensures that 'be_rate' has a defined value before > it is used in subsequent calculations, preventing any warnings or > undefined behavior in cases where the loop does not run. Again, this shuts the warning up but is this actually a good fix?
Attachment:
signature.asc
Description: PGP signature
- References:
- [PATCH] sound: fix uninit-value in sof_ipc4_pcm_dai_link_fixup_rate
- From: Suraj Sonawane
- [PATCH] sound: fix uninit-value in sof_ipc4_pcm_dai_link_fixup_rate
- Prev by Date: Re: [PATCH] sound: fix uninit-value in i2s_dma_isr
- Next by Date: [PATCH 1/2] Revert "ALSA: hda/conexant: Mute speakers at suspend / shutdown"
- Previous by thread: Re: [PATCH] sound: fix uninit-value in sof_ipc4_pcm_dai_link_fixup_rate
- Next by thread: [PATCH v2] sound: fix uninit-value in sof_ipc4_pcm_dai_link_fixup_rate
- Index(es):