Do not solely rely on compiler optimizations to get the workaround
of having macros do nothing using an empty do-while loop. It's
inefficient.
Use ((void)0) to which the standard assert macro expands when NDEBUG
is defined.
No functional change intended.
[mcdofrenchfreis]:
Implement this patch to tree using the command:
git grep -l "do {} while (0)" | xargs sed -i "s/do {} while (0)/((void)0)/g"
Change-Id: I9615c62c46670e31ed8d0d89d195144541baa3e6
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: mcdofrenchfreis <xyzevan@androidist.net>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Update SOC_SINGLE_SX_TLV to SOC_SINGLE_S8_TLV to make codec
driver compatiable with upstream driver.
Change-Id: I4061b015d715978f3b294ad630f53b64bf66c2b7
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Fix is to add check for this ADSP returned buf offset + size,
if it is within the available buf size range
Change-Id: I400cc4f5c07164f0a9b405ebea144ea0ae4b6cf2
Signed-off-by: Shalini Manjunatha <quic_c_shalma@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Avoid copy to user more than requested buffer size
to avoid memory corruption.
Change-Id: Ibf1607f777a358ebd16fd8b8728809afda34eba7
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
tinycap test can attempt with different size to
read from driver and need to avoid access more
than period size.
Change-Id: Ifa4ddfb086bd83aa981da62e88da3a9395f5aabc
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Sometimes during device switch in recording,
observe size 0 is return from DSP due to EOS
handling. For ALSA pcm_read to unblock, buffer
appl_ptr is elapsed without actually updating
the buffer. And userspace copies the stale
data(old buffer) causing issue sometimes.
Reset the buffer for that period_size in
such cases instead of transfer stale data.
Change-Id: I0d3ac133a8d95fad0710586e3e947410a41c9c5a
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Add check for the max hpcm_buf_node size before copy to avoid
buffer out of bounds issue.
Change-Id: Id647888430ce302359a857ef54d321bee99889bf
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Check for the proper param size before copying,
to avoid buffer overflow.
Change-Id: Ic7fa9b3dd047d8eeba3cea02b99d6bc5b9df8daf
Signed-off-by: Shalini Manjunatha <quic_c_shalma@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Check if payload data is big enough before accessing
the data in it.
Change-Id: I939f205a8cebf6ef4859f81fae5429bca013d540
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
techpack/audio/asoc/codecs/wcd_cpe_services.c:658:17: error: implicit
conversion from enumeration type 'enum cpe_svc_result' to different
enumeration type 'enum cmi_api_result' [-Werror,-Wenum-conversion]
notif.result = result;
~ ^~~~~~
techpack/audio/asoc/codecs/wcd_cpe_services.c:1350:8: error: implicit
conversion from enumeration type 'enum cpe_svc_result' to different
enumeration type 'enum cpe_process_result' [-Werror,-Wenum-conversion]
rc = cpe_send_msg_to_inbox(t_info, 0, m);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Change-Id: Ib9fce60017066e9c96e79195d7dba9ffb9177148
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Conversion of negative "num_modules" var value
will result in max possible unsigned int value
and hence can cause mem corruption when accessed.
Resolve this by assigning the same data type
to "num_modules" var as used in the calling fn.
Change-Id: I4c9d7215b9c7345637e1eb3a1992a41fef71c5cb
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Current logic copies user buf size of data
from the avail dsp buf at a given offset.
If this offset returned from DSP in READ_DONE event
goes out of bounds or is corrupted, then it can lead to
out of bounds DSP buffer access, resulting in memory fault.
Fix is to add check for this buf offset, if it is within
the buf size range.
Change-Id: I7753cc6db394704dbb959477150141d42b836bef
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
techpack/audio/asoc/codecs/wcd_cpe_core.c:1981:2: error: 'snprintf' size argument is too large; destination buffer has size 11, but size argument is 13 [-Werror,-Wfortify-source]
snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
^
1 error generated.
Change-Id: I976c005263f44d7a97f1496304acf28df30232a1
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
The reg in soc_dapm_mux is 32-bit. The BE DAI ID passed
as shift(to be operated on the reg) may be more than 31,
which may cause overflow.
Set reg field to SND_SOC_NOPM to avoid any DAPM operation
while passing BE IDs in shift_l field and hence avoid overflow.
Change-Id: Ibbbca04c61b7c56eb4c5a7485a4e93dc28a09709
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: Ia33743c8770dbb3cffe52aa1b57faa3267f37d8f
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: Iebd3f08d5928ce3bd52570447872f935080e6c65
Signed-off-by: Jebaitedneko <Jebaitedneko@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit ee046b18191656af4230d15006bd5957e5b6289e.
The issue has been fixed properly in Idafc26a739df1831d04ea2fde4625e8f9ca1a0ae.
Change-Id: I8275c11660af6cd03907970dea020897b66ceaa3
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
If the driver is not yet initialized, return EPROBE_DEFER to the
external driver trying to register a notification, so that we
don't miss any.
Change-Id: Idafc26a739df1831d04ea2fde4625e8f9ca1a0ae
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Enable interrupt request only when the interrupt is
in disabled state.
Change-Id: I67795bf0ee344661e02b0fec3181cd7980d56652
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: I2bf6f64d34eb082521c92c0b6c22b904d5f73302
Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: I827ac7b62f64bb4166896b4cedcfadd525282c11
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
ANC headphones are no longer supported, removed dead code related to the feature.
Change-Id: I3dd51b5b1d9f77fd870947608f8a14fc3f7aeed0
Signed-off-by: Akhil Karuturi <akarutur@codeaurora.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
check size of payload before access in q6lsm_mmapcallback.
The payload size can be either 4 or 8 bytes.
Code to verify the payload size is atleast 4 bytes is added.
Change-Id: I64b07f44b66fe6793bc80bc99a09fd0521342531
Signed-off-by: Shaik Jabida <quic_sjabida@quicinc.com>
(cherry picked from commit 14c551f6abb3ad841accc8af91c4a18c0a78b2fe)
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
"LA.UM.9.1.r1-16400-SMxxx0.QSSI14.0"
* tag 'LA.UM.9.1.r1-16400-SMxxx0.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
dsp: q6lsm: revert Check size of payload before access
Change-Id: I13f390d1a43aca2ebf7e9f8fd9f91aaa84c5f8fa
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: I481c891b8e853d272cfbe2b6b912dc767f74c710
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
"LA.UM.9.1.r1-16300-SMxxx0.QSSI14.0"
* tag 'LA.UM.9.1.r1-16300-SMxxx0.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
dsp: q6voice: Adds checks for an integer overflow
dsp: q6voice: Adds checks for an integer overflow
dsp: q6lsm: Check size of payload before access
dsp: q6lsm: Check size of payload before access
Fix for OOB access issue
Fix for OOB access issue
ASoC: msm-audio-effects-q6-v2: Add BPF order check
audio-kernel: Add changes in multiple files to unblock CR's
dsp: q6voice: Add buf size check for cvs cal data
Change-Id: I5a461411130da487544d758966e75808d1eb2936
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Basically the charger was detected as USB type-C Headphones so nuke the check as it is retarded
Also the analog USB type-C to 3.5mm Jack dongle doesn't work for us so remove the case entirely
Change-Id: I22b4a7d4280d48b8bfb820a399d5b7e1d7ea74d5
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
"LA.UM.9.1.r1-15900.01-SMxxx0.QSSI14.0"
* tag 'LA.UM.9.1.r1-15900.01-SMxxx0.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
ASoC: msm-audio-effects-q6-v2: Add BPF order check
dsp: q6afe: Add check for fbsp state
Change-Id: I98f9624604c595585d514bfc956fe170e3973019
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
During SSR use cases, when AFE APR handle is NULL
and AFE close is invoked, mutex unlock is done without
locking. Fix it and bail out without unlocking the
mutex in this scenario.
Change-Id: Ia2988b56425d8c2d5c726d5860c13e655e7e4ed1
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
Signed-off-by: azrim <mirzaspc@gmail.com>
The on-stack th_vi_v_vali struct is not fully initialized by
afe_get_sp_th_vi_v_vali_data(), leaving members of the th_vi_v_vali
struct used despite not being initialized. Fix it by zeroing out the
memory in afe_get_sp_th_vi_v_vali_data().
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Fiqri Ardyansyah <fiqri15072019@gmail.com>
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>