* [zanussi-trace:ftrace/synth-fixes-v4 4/5] kernel/trace/trace_events_synth.c:1508:6: warning: variable 'save_argv' is used uninitialized whenever 'if' condition is true
@ 2020-12-18 1:41 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-12-18 1:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4950 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/synth-fixes-v4
head: 6cb978ea1a56e76f723fb7aee74422b0766db8e9
commit: 10708db9327a6db3e8cdd9639504923e6629ae85 [4/5] tracing: Add a backward-compatibility check for synthetic event creation
config: powerpc-randconfig-r023-20201217 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git/commit/?id=10708db9327a6db3e8cdd9639504923e6629ae85
git remote add zanussi-trace https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git
git fetch --no-tags zanussi-trace ftrace/synth-fixes-v4
git checkout 10708db9327a6db3e8cdd9639504923e6629ae85
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> kernel/trace/trace_events_synth.c:1508:6: warning: variable 'save_argv' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!argc)
^~~~~
kernel/trace/trace_events_synth.c:1564:12: note: uninitialized use occurs here
argv_free(save_argv);
^~~~~~~~~
kernel/trace/trace_events_synth.c:1508:2: note: remove the 'if' if its condition is always false
if (!argc)
^~~~~~~~~~
kernel/trace/trace_events_synth.c:1496:33: note: initialize the variable 'save_argv' to silence this warning
char *name, **argv, **save_argv;
^
= NULL
>> kernel/trace/trace_events_synth.c:1508:6: warning: variable 'buf' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!argc)
^~~~~
kernel/trace/trace_events_synth.c:1566:9: note: uninitialized use occurs here
return buf;
^~~
kernel/trace/trace_events_synth.c:1508:2: note: remove the 'if' if its condition is always false
if (!argc)
^~~~~~~~~~
kernel/trace/trace_events_synth.c:1500:11: note: initialize the variable 'buf' to silence this warning
char *buf;
^
= NULL
2 warnings generated.
vim +1508 kernel/trace/trace_events_synth.c
1492
1493 static char *insert_semicolons(const char *raw_command)
1494 {
1495 int i, argc, consumed = 0, n_fields = 0, semis_added = 0;
1496 char *name, **argv, **save_argv;
1497 int ret = -EINVAL;
1498 struct seq_buf s;
1499 bool added_semi;
1500 char *buf;
1501
1502 argc = 0;
1503
1504 argv = argv_split(GFP_KERNEL, raw_command, &argc);
1505 if (!argv)
1506 return NULL;
1507
> 1508 if (!argc)
1509 goto out;
1510
1511 name = argv[0];
1512 save_argv = argv;
1513 argv++;
1514 argc--;
1515
1516 buf = kzalloc(MAX_DYNEVENT_CMD_LEN, GFP_KERNEL);
1517 if (!buf) {
1518 ret = -ENOMEM;
1519 goto err;
1520 }
1521
1522 seq_buf_init(&s, buf, MAX_DYNEVENT_CMD_LEN);
1523
1524 seq_buf_puts(&s, name);
1525 seq_buf_putc(&s, ' ');
1526
1527 if (name[0] == '\0' || argc < 1)
1528 goto err;
1529
1530 for (i = 0; i < argc - 1; i++) {
1531 if (strcmp(argv[i], ";") == 0) {
1532 seq_buf_puts(&s, " ; ");
1533 continue;
1534 }
1535
1536 if (n_fields == SYNTH_FIELDS_MAX)
1537 goto err;
1538
1539 ret = save_synth_field(argc - i, &argv[i], &consumed,
1540 &s, &added_semi);
1541 if (ret)
1542 goto err;
1543
1544 if (added_semi)
1545 semis_added++;
1546
1547 i += consumed - 1;
1548 }
1549
1550 if (i < argc && strcmp(argv[i], ";") != 0)
1551 goto err;
1552
1553 if (!semis_added) {
1554 kfree(buf);
1555 buf = NULL;
1556 goto out;
1557 }
1558
1559 if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
1560 goto err;
1561
1562 buf[s.len] = '\0';
1563 out:
1564 argv_free(save_argv);
1565
1566 return buf;
1567 err:
1568 kfree(buf);
1569 buf = ERR_PTR(ret);
1570
1571 goto out;
1572 }
1573
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33635 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-18 1:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 1:41 [zanussi-trace:ftrace/synth-fixes-v4 4/5] kernel/trace/trace_events_synth.c:1508:6: warning: variable 'save_argv' is used uninitialized whenever 'if' condition is true kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.