Re: [PATCH] mtd: mtdoops: optionally dump boottime

From: kbuild test robot
Date: Sun May 20 2018 - 14:53:29 EST


Hi Stefan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mtd/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Stefan-M-Schaeckeler/mtd-mtdoops-optionally-dump-boottime/20180521-030143
base: git://git.infradead.org/linux-mtd.git master
config: x86_64-randconfig-x011-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

drivers//mtd/mtdoops.c: In function 'mtdoops_init':
>> drivers//mtd/mtdoops.c:78:25: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long int' [-Wformat=]
#define boottime_prefix "<0>[ 0.000000] Boot time "
^
>> drivers//mtd/mtdoops.c:410:8: note: in expansion of macro 'boottime_prefix'
boottime_prefix "%02d/%02d/%4d %02d:%02d:%02d\n",
^~~~~~~~~~~~~~~
drivers//mtd/mtdoops.c:410:37: note: format string is defined here
boottime_prefix "%02d/%02d/%4d %02d:%02d:%02d\n",
~~^
%4ld

vim +/boottime_prefix +410 drivers//mtd/mtdoops.c

395
396 static int __init mtdoops_init(void)
397 {
398 struct mtdoops_context *cxt = &oops_cxt;
399 int mtd_index;
400 char *endp;
401 struct timespec64 bt;
402 struct tm tm_val;
403
404 if (dump_boottime) {
405 /* Precompute boot time ahead of an oops */
406 getboottime64(&bt);
407 time_to_tm(bt.tv_sec, 0, &tm_val);
408
409 snprintf(boottime, sizeof(boottime),
> 410 boottime_prefix "%02d/%02d/%4d %02d:%02d:%02d\n",
411 tm_val.tm_mon + 1, tm_val.tm_mday, tm_val.tm_year + 1900,
412 tm_val.tm_hour, tm_val.tm_min, tm_val.tm_sec);
413 }
414
415 if (strlen(mtddev) == 0) {
416 printk(KERN_ERR "mtdoops: mtd device (mtddev=name/number) must be supplied\n");
417 return -EINVAL;
418 }
419 if ((record_size & 4095) != 0) {
420 printk(KERN_ERR "mtdoops: record_size must be a multiple of 4096\n");
421 return -EINVAL;
422 }
423 if (record_size < 4096) {
424 printk(KERN_ERR "mtdoops: record_size must be over 4096 bytes\n");
425 return -EINVAL;
426 }
427
428 /* Setup the MTD device to use */
429 cxt->mtd_index = -1;
430 mtd_index = simple_strtoul(mtddev, &endp, 0);
431 if (*endp == '\0')
432 cxt->mtd_index = mtd_index;
433
434 cxt->oops_buf = vmalloc(record_size);
435 if (!cxt->oops_buf) {
436 printk(KERN_ERR "mtdoops: failed to allocate buffer workspace\n");
437 return -ENOMEM;
438 }
439 memset(cxt->oops_buf, 0xff, record_size);
440
441 INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase);
442 INIT_WORK(&cxt->work_write, mtdoops_workfunc_write);
443
444 register_mtd_user(&mtdoops_notifier);
445 return 0;
446 }
447

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip