linux-stable/sound/soc/fsl
Justin Stitt 7eb10bfbba
ASoC: fsl_micfil: refactor deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ always the case for `strncpy`!

In this case, though, there was great care taken to ensure that the
destination buffer would be NUL-terminated through the use of `len - 1`
ensuring that the previously zero-initialized buffer would not overwrite
the last NUL byte. This means that there's no bug here.

However, `strscpy` will add a mandatory NUL byte to the destination
buffer as promised by the following `strscpy` implementation [3]:
|       /* Hit buffer length without finding a NUL; force NUL-termination. */
|       if (res)
|               dest[res-1] = '\0';

This means we can lose the `- 1` which clears up whats happening here.
All the while, we get one step closer to eliminating the ambiguous
`strncpy` api in favor of its less ambiguous replacement like `strscpy`,
`strscpy_pad`, `strtomem` and `strtomem_pad` amongst others.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html
[3]: https://elixir.bootlin.com/linux/v6.3/source/lib/string.c#L183

Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230727-sound-soc-fsl-v1-1-4fc0ed7e0366@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-28 12:58:37 +01:00
..
efika-audio-fabric.c
eukrea-tlv320.c ASoC: fsl: eukrea-tlv320: Convert to platform remove callback returning void 2023-03-20 13:07:56 +00:00
fsl-asoc-card.c ASoC: fsl-asoc-card: Allow passing the number of slots in use 2023-06-21 13:42:51 +01:00
fsl_asrc.c ASoC: fsl: fsl_asrc: Convert to platform remove callback returning void 2023-03-20 13:07:56 +00:00
fsl_asrc.h
fsl_asrc_common.h
fsl_asrc_dma.c ASoC: fsl_asrc_dma: fix potential null-ptr-deref 2023-04-19 13:42:56 +01:00
fsl_aud2htx.c ASoC: fsl: fsl_aud2htx: Convert to platform remove callback returning void 2023-03-20 13:07:57 +00:00
fsl_aud2htx.h
fsl_audmix.c ASoC: fsl: fsl_audmix: Convert to platform remove callback returning void 2023-03-20 13:07:58 +00:00
fsl_audmix.h
fsl_dma.c ASoC: fsl: fsl_dma: Convert to platform remove callback returning void 2023-03-20 13:07:59 +00:00
fsl_dma.h
fsl_easrc.c ASoC: fsl: fsl_easrc: Convert to platform remove callback returning void 2023-03-20 13:08:00 +00:00
fsl_easrc.h ASoC: fsl_easrc: use snd_pcm_format_t type for sample_format 2022-07-21 13:38:51 +01:00
fsl_esai.c ASoC: fsl: fsl_esai: Convert to platform remove callback returning void 2023-03-20 13:08:01 +00:00
fsl_esai.h
fsl_micfil.c ASoC: fsl_micfil: refactor deprecated strncpy 2023-07-28 12:58:37 +01:00
fsl_micfil.h ASoC: fsl_micfil: Add Hardware Voice Activity Detector support 2022-10-17 12:48:25 +01:00
fsl_mqs.c ASoC: fsl_mqs: move of_node_put() to the correct location 2023-04-17 20:16:26 +01:00
fsl_qmc_audio.c ASoC: fsl: fsl_qmc_audio: Fix snd_pcm_format_t values handling 2023-07-26 19:08:15 +01:00
fsl_rpmsg.c ASoC: fsl_rpmsg: Add support for i.MX93 platform 2023-07-17 06:15:28 +01:00
fsl_rpmsg.h ASoC: fsl_rpmsg: add soc specific data structure 2021-09-13 01:59:15 +01:00
fsl_sai.c ASoC: fsl_sai: Disable bit clock with transmitter 2023-07-17 19:15:07 +01:00
fsl_sai.h ASoC: fsl_sai: Disable bit clock with transmitter 2023-07-17 19:15:07 +01:00
fsl_spdif.c ASoC: fsl_spdif: Add support for 22.05 kHz sample rate 2023-07-19 18:47:18 +01:00
fsl_spdif.h ASoC: fsl_spdif: Add support for 22.05 kHz sample rate 2023-07-19 18:47:18 +01:00
fsl_ssi.c ASoC: fsl: fsl_ssi: Convert to platform remove callback returning void 2023-03-20 13:08:06 +00:00
fsl_ssi.h
fsl_ssi_dbg.c
fsl_utils.c ASoC: fsl: fsl-utils: remove useless assignment 2022-08-31 12:13:03 +01:00
fsl_utils.h ASoC: fsl_utils: Add function to handle PLL clock source 2022-07-05 13:00:37 +01:00
fsl_xcvr.c ASoC: fsl: fsl_xcvr: Convert to platform remove callback returning void 2023-03-20 13:08:07 +00:00
fsl_xcvr.h ASoC: fsl_xcvr: Add support for i.MX93 platform 2023-01-09 13:04:22 +00:00
imx-audio-rpmsg.c ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL 2022-10-17 12:48:13 +01:00
imx-audmix.c ASoC: imx-audmix: check return value of devm_kasprintf() 2023-06-19 12:59:27 +01:00
imx-audmux.c ASoC: fsl: imx-audmux: Convert to platform remove callback returning void 2023-03-20 13:08:08 +00:00
imx-audmux.h
imx-card.c ASoC: fsl: use snd_soc_{of_}get_dlc() 2023-06-20 12:49:23 +01:00
imx-es8328.c ASoC: fsl: imx-es8328: cleanup platform which is using Generic DMA 2023-04-21 13:45:04 +01:00
imx-hdmi.c ASoC: imx-hdmi: Use dev_err_probe 2023-01-28 10:51:04 +00:00
imx-pcm-dma.c ASoC: fsl: Drop unused argument from imx_pcm_dma_init() 2022-02-28 13:33:57 +00:00
imx-pcm-fiq.c ASoC: fsl: imx-pcm-fiq: Use managed buffer allocation 2021-08-04 08:08:42 +02:00
imx-pcm-rpmsg.c ASoC: imx-pcm-rpmsg: Set PCM hardware parameters separately 2023-07-09 22:50:57 +01:00
imx-pcm-rpmsg.h
imx-pcm.h ASoC: fsl: Remove unused inline function imx_pcm_dma_params_init_data() 2022-09-23 13:56:25 +01:00
imx-rpmsg.c ASoC: fsl: use snd_soc_{of_}get_dlc() 2023-06-20 12:49:23 +01:00
imx-sgtl5000.c ASoC: fsl: imx-sgtl5000: Convert to platform remove callback returning void 2023-03-20 13:08:09 +00:00
imx-spdif.c ASoC: fsl: use asoc_dummy_dlc 2023-05-08 08:47:09 +09:00
imx-ssi.h dmaengine: imx: Move header to include/dma/ 2022-04-19 12:06:18 +01:00
Kconfig ASoC: Merge up fixes as a dependency for future SOF work 2023-03-13 14:07:37 +00:00
Makefile ASoC: fsl: Add support for QMC audio 2023-03-05 23:37:10 +00:00
mpc5200_dma.c ASoC: mpc5200: Use managed buffer allocation 2021-08-04 08:09:16 +02:00
mpc5200_dma.h
mpc5200_psc_ac97.c ASoC: fsl: mpc5200_psc_ac97: Convert to platform remove callback returning void 2023-03-20 13:08:10 +00:00
mpc5200_psc_i2s.c ASoC: fsl: mpc5200_psc_i2s: Convert to platform remove callback returning void 2023-03-20 13:08:11 +00:00
mpc8610_hpcd.c ASoC: fsl: mpc8610_hpcd: Convert to platform remove callback returning void 2023-03-20 13:08:12 +00:00
p1022_ds.c ASoC: fsl: p1022_ds: Convert to platform remove callback returning void 2023-03-20 13:08:13 +00:00
p1022_rdk.c ASoC: fsl: p1022_rdk: Convert to platform remove callback returning void 2023-03-20 13:08:14 +00:00
pcm030-audio-fabric.c ASoC: fsl: pcm030-audio-fabric: Convert to platform remove callback returning void 2023-03-20 13:08:15 +00:00