[tiwai-sound:for-next 12/12] sound/core/pcm_memory.c:218:29: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   43b42ed438bfff6bb5a51cc27a1658c03cd223fd
commit: 43b42ed438bfff6bb5a51cc27a1658c03cd223fd [12/12] ALSA: pcm: Fix the previous conversion to kstrtoul()
config: i386-buildonly-randconfig-002-20240902 (https://download.01.org/0day-ci/archive/20240902/202409020722.T2ymGxmq-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240902/202409020722.T2ymGxmq-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409020722.T2ymGxmq-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> sound/core/pcm_memory.c:218:29: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Wformat]
     215 |                                 pr_debug("ALSA pcmC%dD%d%c,%d:%s: cannot preallocate for size %zu\n",
         |                                                                                               ~~~
         |                                                                                               %lu
     216 |                                          substream->pcm->card->number, substream->pcm->device,
     217 |                                          substream->stream ? 'c' : 'p', substream->number,
     218 |                                          substream->pcm->name, size);
         |                                                                ^~~~
   include/linux/printk.h:595:38: note: expanded from macro 'pr_debug'
     595 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
         |                                     ~~~     ^~~~~~~~~~~
   include/linux/printk.h:133:18: note: expanded from macro 'no_printk'
     133 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                         ~~~    ^~~~~~~~~~~
   1 warning generated.


vim +218 sound/core/pcm_memory.c

c7132aeb72ad11 Jaroslav Kysela    2006-10-06  174  
^1da177e4c3f41 Linus Torvalds     2005-04-16  175  /*
^1da177e4c3f41 Linus Torvalds     2005-04-16  176   * write callback for prealloc proc file
^1da177e4c3f41 Linus Torvalds     2005-04-16  177   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  178   * accepts the preallocation size in kB.
^1da177e4c3f41 Linus Torvalds     2005-04-16  179   */
877211f5e1b119 Takashi Iwai       2005-11-17  180  static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
877211f5e1b119 Takashi Iwai       2005-11-17  181  					       struct snd_info_buffer *buffer)
^1da177e4c3f41 Linus Torvalds     2005-04-16  182  {
877211f5e1b119 Takashi Iwai       2005-11-17  183  	struct snd_pcm_substream *substream = entry->private_data;
d4cfb30fce0309 Takashi Iwai       2020-01-20  184  	struct snd_card *card = substream->pcm->card;
^1da177e4c3f41 Linus Torvalds     2005-04-16  185  	char line[64], str[64];
43b42ed438bfff Takashi Iwai       2024-09-01  186  	unsigned long size;
^1da177e4c3f41 Linus Torvalds     2005-04-16  187  	struct snd_dma_buffer new_dmab;
^1da177e4c3f41 Linus Torvalds     2005-04-16  188  
dd0da75b9a2768 Takashi Iwai       2024-02-27  189  	guard(mutex)(&substream->pcm->open_mutex);
^1da177e4c3f41 Linus Torvalds     2005-04-16  190  	if (substream->runtime) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  191  		buffer->error = -EBUSY;
dd0da75b9a2768 Takashi Iwai       2024-02-27  192  		return;
^1da177e4c3f41 Linus Torvalds     2005-04-16  193  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  194  	if (!snd_info_get_line(buffer, line, sizeof(line))) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  195  		snd_info_get_str(str, line, sizeof(str));
61bc4deff03318 Hongbo Li          2024-08-31  196  		buffer->error = kstrtoul(str, 10, &size);
61bc4deff03318 Hongbo Li          2024-08-31  197  		if (buffer->error != 0)
61bc4deff03318 Hongbo Li          2024-08-31  198  			return;
61bc4deff03318 Hongbo Li          2024-08-31  199  		size *= 1024;
^1da177e4c3f41 Linus Torvalds     2005-04-16  200  		if ((size != 0 && size < 8192) || size > substream->dma_max) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  201  			buffer->error = -EINVAL;
dd0da75b9a2768 Takashi Iwai       2024-02-27  202  			return;
^1da177e4c3f41 Linus Torvalds     2005-04-16  203  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  204  		if (substream->dma_buffer.bytes == size)
dd0da75b9a2768 Takashi Iwai       2024-02-27  205  			return;
^1da177e4c3f41 Linus Torvalds     2005-04-16  206  		memset(&new_dmab, 0, sizeof(new_dmab));
^1da177e4c3f41 Linus Torvalds     2005-04-16  207  		new_dmab.dev = substream->dma_buffer.dev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  208  		if (size > 0) {
d4cfb30fce0309 Takashi Iwai       2020-01-20  209  			if (do_alloc_pages(card,
d4cfb30fce0309 Takashi Iwai       2020-01-20  210  					   substream->dma_buffer.dev.type,
^1da177e4c3f41 Linus Torvalds     2005-04-16  211  					   substream->dma_buffer.dev.dev,
a25684a956468e Takashi Iwai       2021-10-17  212  					   substream->stream,
^1da177e4c3f41 Linus Torvalds     2005-04-16  213  					   size, &new_dmab) < 0) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  214  				buffer->error = -ENOMEM;
dc85fc9d05d235 Amadeusz Sławiński 2021-03-18  215  				pr_debug("ALSA pcmC%dD%d%c,%d:%s: cannot preallocate for size %zu\n",
dc85fc9d05d235 Amadeusz Sławiński 2021-03-18  216  					 substream->pcm->card->number, substream->pcm->device,
dc85fc9d05d235 Amadeusz Sławiński 2021-03-18  217  					 substream->stream ? 'c' : 'p', substream->number,
dc85fc9d05d235 Amadeusz Sławiński 2021-03-18 @218  					 substream->pcm->name, size);
dd0da75b9a2768 Takashi Iwai       2024-02-27  219  				return;
^1da177e4c3f41 Linus Torvalds     2005-04-16  220  			}
^1da177e4c3f41 Linus Torvalds     2005-04-16  221  			substream->buffer_bytes_max = size;
^1da177e4c3f41 Linus Torvalds     2005-04-16  222  		} else {
^1da177e4c3f41 Linus Torvalds     2005-04-16  223  			substream->buffer_bytes_max = UINT_MAX;
^1da177e4c3f41 Linus Torvalds     2005-04-16  224  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  225  		if (substream->dma_buffer.area)
d4cfb30fce0309 Takashi Iwai       2020-01-20  226  			do_free_pages(card, &substream->dma_buffer);
^1da177e4c3f41 Linus Torvalds     2005-04-16  227  		substream->dma_buffer = new_dmab;
^1da177e4c3f41 Linus Torvalds     2005-04-16  228  	} else {
^1da177e4c3f41 Linus Torvalds     2005-04-16  229  		buffer->error = -EINVAL;
^1da177e4c3f41 Linus Torvalds     2005-04-16  230  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  231  }
^1da177e4c3f41 Linus Torvalds     2005-04-16  232  

:::::: The code at line 218 was first introduced by commit
:::::: dc85fc9d05d23591ddfde400c817413765611ec7 ALSA: pcm: Add debug print on memory allocation failure

:::::: TO: Amadeusz Sławiński <amadeuszx.slawinski@xxxxxxxxxxxxxxx>
:::::: CC: Takashi Iwai <tiwai@xxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux