tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: faa52e40c08916893e09ba030e616f92e4fc020b commit: a24ec7d8d3462ba48b4bd932960c397d92de8782 [1325/1325] ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is not set config: arm64-randconfig-004-20241207 (https://download.01.org/0day-ci/archive/20241207/202412071942.X656h6F5-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241207/202412071942.X656h6F5-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202412071942.X656h6F5-lkp@intel.com/
All warnings (new ones prefixed by >>):
sound/soc/soc-generic-dmaengine-pcm.c: In function 'dmaengine_pcm_new':
sound/soc/soc-generic-dmaengine-pcm.c:318:25: warning: 'strncpy' accessing 80 bytes at offsets 100 and 36 may overlap up to 0 bytes at offset [9223372036854775807, -9223372036854775808] [-Wrestrict]
318 | strncpy(rtd->pcm->streams[i].pcm->name, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 319 | rtd->pcm->streams[i].pcm->id, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | sizeof(rtd->pcm->streams[i].pcm->name)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +318 sound/soc/soc-generic-dmaengine-pcm.c
260 261 static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) 262 { 263 struct snd_soc_component *component = 264 snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); 265 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); 266 const struct snd_dmaengine_pcm_config *config = pcm->config; 267 struct device *dev = component->dev; 268 struct snd_dmaengine_dai_dma_data *dma_data; 269 struct snd_pcm_substream *substream; 270 size_t prealloc_buffer_size; 271 size_t max_buffer_size; 272 unsigned int i; 273 int ret; 274 275 if (config && config->prealloc_buffer_size) { 276 prealloc_buffer_size = config->prealloc_buffer_size; 277 max_buffer_size = config->pcm_hardware->buffer_bytes_max; 278 } else { 279 prealloc_buffer_size = 512 * 1024; 280 max_buffer_size = SIZE_MAX; 281 } 282 283 for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) { 284 substream = rtd->pcm->streams[i].substream; 285 if (!substream) 286 continue; 287 288 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 289 290 if (!pcm->chan[i] && 291 (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) 292 pcm->chan[i] = dma_request_slave_channel(dev, 293 dma_data->chan_name); 294 295 if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { 296 pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, 297 substream); 298 } 299 300 if (!pcm->chan[i]) { 301 dev_err(component->dev, 302 "Missing dma channel for stream: %d\n", i); 303 return -EINVAL; 304 } 305 306 ret = snd_pcm_lib_preallocate_pages(substream, 307 SNDRV_DMA_TYPE_DEV_IRAM, 308 dmaengine_dma_dev(pcm, substream), 309 prealloc_buffer_size, 310 max_buffer_size); 311 if (ret) 312 return ret; 313 314 if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i])) 315 pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE; 316 317 if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
318 strncpy(rtd->pcm->streams[i].pcm->name,
319 rtd->pcm->streams[i].pcm->id, 320 sizeof(rtd->pcm->streams[i].pcm->name)); 321 } 322 } 323 324 return 0; 325 } 326