Skip to contentSkip to conversation

sound/core/pcm_memory.c:196:51: error: passing argument 3 of 'kstrtoul' from incompatible pointer type

PATCH kernel test robot 1 participant 1 message Aug 31, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   61bc4deff033181992408f973b48fca08757d3ff
commit: 61bc4deff033181992408f973b48fca08757d3ff [11/11] ALSA: pcm: replace simple_strtoul to kstrtoul
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240901/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240901/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

sound/core/pcm_memory.c: In function 'snd_pcm_lib_preallocate_proc_write':

>> sound/core/pcm_memory.c:196:51: error: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
     196 |                 buffer->error = kstrtoul(str, 10, &size);
         |                                                   ^~~~~
         |                                                   |
         |                                                   size_t * {aka unsigned int *}
   In file included from include/linux/kernel.h:25,
                    from arch/sh/include/asm/fixmap.h:13,
                    from arch/sh/include/asm/pgtable.h:22,
                    from include/linux/pgtable.h:6,
                    from arch/sh/include/asm/io.h:21,
                    from include/linux/io.h:14,
                    from sound/core/pcm_memory.c:7:

include/linux/kstrtox.h:30:90: note: expected 'long unsigned int *' but argument is of type 'size_t *' {aka 'unsigned int *'}
30 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
| ~~~~~~~~~~~~~~~^~~

vim +/kstrtoul +196 sound/core/pcm_memory.c

174
175 /*
176 * write callback for prealloc proc file
177 *
178 * accepts the preallocation size in kB.
179 */
180 static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
181 struct snd_info_buffer *buffer)
182 {
183 struct snd_pcm_substream *substream = entry->private_data;
184 struct snd_card *card = substream->pcm->card;
185 char line[64], str[64];
186 size_t size;
187 struct snd_dma_buffer new_dmab;
188
189 guard(mutex)(&substream->pcm->open_mutex);
190 if (substream->runtime) {
191 buffer->error = -EBUSY;
192 return;
193 }
194 if (!snd_info_get_line(buffer, line, sizeof(line))) {
195 snd_info_get_str(str, line, sizeof(str));

 > 196			buffer->error = kstrtoul(str, 10, &size);
   197			if (buffer->error != 0)
   198				return;
   199			size *= 1024;
   200			if ((size != 0 && size < 8192) || size > substream->dma_max) {
   201				buffer->error = -EINVAL;
   202				return;
   203			}
   204			if (substream->dma_buffer.bytes == size)
   205				return;
   206			memset(&new_dmab, 0, sizeof(new_dmab));
   207			new_dmab.dev = substream->dma_buffer.dev;
   208			if (size > 0) {
   209				if (do_alloc_pages(card,
   210						   substream->dma_buffer.dev.type,
   211						   substream->dma_buffer.dev.dev,
   212						   substream->stream,
   213						   size, &new_dmab) < 0) {

214 buffer->error = -ENOMEM;
215 pr_debug("ALSA pcmC%dD%d%c,%d:%s: cannot preallocate for size %zu\n",
216 substream->pcm->card->number, substream->pcm->device,
217 substream->stream ? 'c' : 'p', substream->number,
218 substream->pcm->name, size);
219 return;
220 }
221 substream->buffer_bytes_max = size;
222 } else {
223 substream->buffer_bytes_max = UINT_MAX;
224 }
225 if (substream->dma_buffer.area)
226 do_free_pages(card, &substream->dma_buffer);
227 substream->dma_buffer = new_dmab;
228 } else {
229 buffer->error = -EINVAL;
230 }
231 }
232

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