ADSBDemodSink::processOneSample() updates m_magsqSum, m_magsqPeak, and
m_magsqCount from the sample processing path, while getMagSqLevels()
reads and updates the same statistics when the GUI requests the current
magnitude levels. Thus, two different threads can read and write the
same variables concurrently.
Protect both access paths with a new m_magsqMutex to prevent concurrent
updates and reads of the magnitude statistics.
This eliminates the data race identified by ThreadSanitizer and
prevents the GUI from observing partially updated magnitude statistics
while ADS-B samples are being processed.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
m_running is used to synchronize the PlutoSDR manager and runner
threads. The manager-side startWork() and stopWork() functions control
whether the runner in run() should execute.
startWork() reads m_running before starting the QThread and then waits
for run() to set it true. stopWork() sets m_running false to request
that the runner exit, while run() continuously reads the flag and sets
it false when it terminates.
These accesses occur across the manager and runner threads without
atomic synchronization. Make m_running an atomic_bool in the PlutoSDR
input, output, MIMO input, and MIMO output threads to eliminate the data
race identified by ThreadSanitizer.
This can prevent inconsistent thread state during user-driven device
start, stop, and reload operations, where the GUI can cause the manager
thread to start or stop a PlutoSDR runner while that runner is
processing.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Use size_t for the scan result index calculation so that the reverse
index calculation cannot produce an index of -1. This prevents an
invalid negative index from being used to access m_scanResults.
Reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the squelch mode, timing, and AM squelch values to defined
defaults to resolve the Coverity UNINIT_CTOR warning and ensure
deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_pan to a defined default to resolve the Coverity UNINIT_CTOR
warning and ensure deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize FM deviation, AF, limiter, and CTCSS settings to defined
defaults to resolve the Coverity UNINIT_CTOR warning and ensure
deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize DNR scheme, gain, NPE, position, and artifact reduction values
to defined defaults to resolve the Coverity UNINIT_CTOR warning and ensure
deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize DNB scheme, mode, timing, threshold, and averaging values to
defined defaults to resolve the Coverity UNINIT_CTOR warning and ensure
deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the CW peak frequency, bandwidth, and gain to defined defaults
to resolve the Coverity UNINIT_CTOR warning and ensure deterministic
dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the fade level to a defined default to resolve the Coverity
UNINIT_CTOR warning and ensure deterministic dialog state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the AGC mode, slope, and hang threshold to defined defaults to
resolve the Coverity UNINIT_CTOR warning and ensure deterministic dialog
state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_running to false to resolve the Coverity UNINIT_CTOR warning
and ensure the baseband starts in a defined stopped state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_deviceSampleFifo to null to resolve the Coverity UNINIT_CTOR
warning and ensure the worker starts with a defined FIFO pointer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the squelch level and count to defined defaults to resolve
Coverity UNINIT_CTOR warnings and ensure deterministic initial state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the baseband sample rate and spectrum visualizer pointer to
defined defaults to resolve Coverity UNINIT_CTOR warnings and ensure
deterministic initial state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize varPhase and varMag to defined defaults to resolve Coverity
UNINIT warnings when the variable and reference Goertzel windows are
not provably aligned.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the decoded data pointer array to null to resolve the Coverity
UNINIT_CTOR warning and ensure deterministic decoder state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_maxTrials to a defined default to resolve the Coverity
UNINIT_CTOR warning and ensure the dialog starts with deterministic state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized decoder state members to defined
defaults to resolve Coverity UNINIT_CTOR warnings and ensure the decoder
starts from a deterministic state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize LDPC state members to defined values instead of leaving them
uninitialized until first_bit() is called.
This makes the class state explicit and removes cppcheck
uninitMemberVarNoCtor warnings reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Use QCheckBox::checkStateChanged() with Qt 6.7 and newer while
retaining stateChanged() for older Qt versions and Qt5.
Convert the Qt::CheckState argument to int to preserve the existing
slot interface.
This removes the Qt6 deprecation warning while maintaining Qt5
compatibility.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Remove the unused loop index from rdsUpdate() since it was incremented
but never referenced.
This eliminates the -Wunused-but-set-variable compiler warning.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add Q_FALLTHROUGH() when crApp=4 falls through to the crApp=3
syndrome logic. This preserves the existing behavior while avoiding
implicit-fallthrough warnings across GCC, Clang, and MSVC.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Remove the obsolete corr variable and assignment from the AIS demodulator.
The normalized correlation metric is used for both threshold detection and
scope output, so the raw correlation value is no longer needed.
Fixes a -Wunused-but-set-variable warning reported by GCC.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add Q_FALLTHROUGH() when crApp=4 falls through to the crApp=3
syndrome logic. This preserves the existing behavior while avoiding
implicit-fallthrough warnings across GCC, Clang, and MSVC.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_centerFrequency in the RadioClock constructor to avoid
using an uninitialized value.
This resolves the Coverity UNINIT_CTOR finding.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize NoiseFigure state and measurement members before they are used,
including the center frequency, sweep state, power measurements, and VISA
session.
This resolves Coverity UNINIT_CTOR findings for members that previously
relied on implicit initialization.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_centerFrequency in the HeatMap constructor to avoid using an
uninitialized value.
Found by Coverity (CID 652316).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the center frequency and signal magnitude tracking members
before they are accessed.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize PacketDemodCore members that were left indeterminate by the
compiler-generated constructor. This gives the sample counters, estimated
tone and deviation values, transition timestamp, and live decode count
defined initial values.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the NFM demodulator thread and baseband sink pointers before
they are accessed during construction.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize frequency-related state in the LeanSDR sampler and
constellation receiver to prevent use of uninitialized values during
startup.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Value-initialize the pipebuf reader pointer array so all reader entries
start in a defined state.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize simplequeue storage and s2_fecdec_helper state to prevent
uninitialized member access.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize BLOCKS, m_codeLen, and m_dataLen in LDPCWorker so they have
defined values when construction exits early due to an unsupported
MODCOD or missing LDPC table.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_thread and m_basebandSink to nullptr in BFMDemod's
constructor to prevent uninitialized pointer use.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_centerFrequency to zero in the ChannelPower constructor
to prevent use of an uninitialized value.
Reported by Coverity (CID 652667).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_centerFrequency to zero in the ChannelAnalyzer constructor to
ensure the device-provided frequency state is defined before it is received.
Found by Coverity (CID 653807).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the channel pointer and spectrum probe undersample count
to ensure deterministic initial state.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized channel, timing, threshold, and
demodulation state in RadioClockSink.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the channel pointer and hot-state flag in
RadioAstronomySink to avoid uninitialized member values.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_channel to nullptr in NoiseFigureSink to avoid an
uninitialized member pointer.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_spectrumGUI to nullptr in the LocalSinkSettings constructor.
Keep the runtime GUI association separate from resetToDefaults().
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_channel to nullptr in the HeatMapSink constructor to avoid
leaving the channel pointer uninitialized.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_scopeGUI to nullptr in the HeatMapSettings constructor to
avoid leaving the member uninitialized.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the channel sample rate, frequency offset, center frequency,
and device UID to defined values.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the FileSinkBaseband spectrum sink, GUI message queue,
center frequency, and timer to defined values.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the WFMDemodSink channel pointer to nullptr so it has a
defined value before a channel is assigned.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the interpolator distances, channel message queue pointer,
and audio interpolator distances in VORDemodSCSink to ensure these
members have defined values before use.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the SSBDemodSink channel pointer to nullptr to ensure the
member has a defined value before a channel is assigned.
Identified by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>