From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [qais-yousef:sched-setscheduler-hide 12/12] kernel/kthread.c:1570 param_get_namefmt() warn: variable dereferenced before check 'param' (see line 1567)
Date: Fri, 8 Sep 2023 19:24:34 +0800 [thread overview]
Message-ID: <202309081907.lbs9VWMn-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Qais Yousef <qyousef@layalina.io>
tree: https://github.com/qais-yousef/linux sched-setscheduler-hide
head: 557fb1e21399de5f674beb93fa6793adce124cc2
commit: 557fb1e21399de5f674beb93fa6793adce124cc2 [12/12] kthread: Implement parameter handling logic
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-161-20230907 (https://download.01.org/0day-ci/archive/20230908/202309081907.lbs9VWMn-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230908/202309081907.lbs9VWMn-lkp@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202309081907.lbs9VWMn-lkp@intel.com/
smatch warnings:
kernel/kthread.c:1570 param_get_namefmt() warn: variable dereferenced before check 'param' (see line 1567)
kernel/kthread.c:1794 param_set_sched_util_min() warn: ignoring unreachable code.
vim +/param +1570 kernel/kthread.c
4328f6314232c50e Qais Yousef 2023-08-26 1558
4328f6314232c50e Qais Yousef 2023-08-26 1559 /*
4328f6314232c50e Qais Yousef 2023-08-26 1560 * Kthread sysfs params handling
4328f6314232c50e Qais Yousef 2023-08-26 1561 */
557fb1e21399de5f Qais Yousef 2023-08-27 1562 static int param_get_namefmt(char *buffer, int len,
557fb1e21399de5f Qais Yousef 2023-08-27 1563 const char *name, const char *param)
557fb1e21399de5f Qais Yousef 2023-08-27 1564 {
557fb1e21399de5f Qais Yousef 2023-08-27 1565 int namelen = strlen(name);
557fb1e21399de5f Qais Yousef 2023-08-27 1566 int kthreadlen = strlen("kthread.");
557fb1e21399de5f Qais Yousef 2023-08-27 @1567 int paramlen = strlen(param);
557fb1e21399de5f Qais Yousef 2023-08-27 1568 int size = namelen - kthreadlen - paramlen;
557fb1e21399de5f Qais Yousef 2023-08-27 1569
557fb1e21399de5f Qais Yousef 2023-08-27 @1570 if (!namelen || !param || size > len)
557fb1e21399de5f Qais Yousef 2023-08-27 1571 return -EINVAL;
557fb1e21399de5f Qais Yousef 2023-08-27 1572
557fb1e21399de5f Qais Yousef 2023-08-27 1573 strlcpy(buffer, name + kthreadlen, size);
557fb1e21399de5f Qais Yousef 2023-08-27 1574
557fb1e21399de5f Qais Yousef 2023-08-27 1575 return 0;
557fb1e21399de5f Qais Yousef 2023-08-27 1576 }
557fb1e21399de5f Qais Yousef 2023-08-27 1577
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-09-08 11:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 11:24 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-08 16:19 [qais-yousef:sched-setscheduler-hide 12/12] kernel/kthread.c:1570 param_get_namefmt() warn: variable dereferenced before check 'param' (see line 1567) Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202309081907.lbs9VWMn-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.