On 12/08/20 17:35, kernel test robot wrote:
Hi Valentin,
Thank you for the patch! Perhaps something to improve:
[...]
url:
https://github.com/0day-ci/linux/commits/Valentin-Schneider/sched-Instrum...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
949bcb8135a96a6923e676646bd29cbe69e8350f
config: i386-randconfig-s001-20200811 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-168-g9554805c-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
>> kernel/sched/debug.c:279:17: sparse: sparse: non
size-preserving pointer to integer cast
>> kernel/sched/debug.c:279:17: sparse: sparse: non size-preserving integer to
pointer cast
271
272 tmp = kcalloc(data_size + 1, sizeof(tmp), GFP_KERNEL);
273 for_each_set_bit(idx, &flags, __SD_FLAG_CNT) {
274 char *name = sd_flag_debug[idx].name;
275
276 len += snprintf(tmp + len, strlen(name) + 2, "%s ", name);
277 }
278
> 279 tmp += *ppos;
I pretty much copied kernel/sysctl.c::_proc_do_string() and I think that's
exactly the same types here: char* buffer incremented by loff_t offset. It
does look fine to me, but I can't really parse that warning.
> 280 len -= *ppos;
> 281
> 282 if (len > *lenp)
> 283 len = *lenp;
> 284 if (len)
> 285 memcpy(buffer, tmp, len);
> 286 if (len < *lenp) {
> 287 ((char *)buffer)[len] = '\n';
> 288 len++;
> 289 }
> 290
> 291 *lenp = len;
> 292 *ppos += len;
> 293
> 294 kfree(tmp);
> 295
> 296 return 0;
> 297 }
> 298
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
>
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org