[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7794115e-607f-4ba9-b833-a45b500f46b6@sirena.org.uk>
Date: Wed, 30 Oct 2024 17:17:23 +0000
From: Mark Brown <broonie@...nel.org>
To: Suraj Sonawane <surajsonawane0215@...il.com>
Cc: lgirdwood@...il.com, peter.ujfalusi@...ux.intel.com,
yung-chuan.liao@...ux.intel.com, ranjani.sridharan@...ux.intel.com,
daniel.baluta@....com, kai.vehmanen@...ux.intel.com,
pierre-louis.bossart@...ux.dev, perex@...ex.cz, tiwai@...e.com,
sound-open-firmware@...a-project.org, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sound: fix uninit-value in
sof_ipc4_pcm_dai_link_fixup_rate
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?
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists