From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Sean Anderson <sean.anderson@seco.com>
Subject: [linux-next:master 2112/3285] drivers/net/phy/phylink.c:588 phylink_validate_mask_caps() warn: variable dereferenced before check 'state' (see line 583)
Date: Mon, 24 Oct 2022 17:30:23 +0300 [thread overview]
Message-ID: <202210242228.KXXNz0bU-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 76cf65d1377f733af1e2a55233e3353ffa577f54
commit: f392a1846489720fc2e063d1210633b6cf4ec5a4 [2112/3285] net: phylink: provide phylink_validate_mask_caps() helper
config: microblaze-randconfig-m031-20221023
compiler: microblaze-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/net/phy/phylink.c:588 phylink_validate_mask_caps() warn: variable dereferenced before check 'state' (see line 583)
Old smatch warnings:
drivers/net/phy/phylink.c:1104 phylink_change_inband_advert() error: we previously assumed 'pl->pcs' could be null (see line 1087)
vim +/state +588 drivers/net/phy/phylink.c
f392a184648972 Russell King (Oracle 2022-10-17 574) void phylink_validate_mask_caps(unsigned long *supported,
f392a184648972 Russell King (Oracle 2022-10-17 575) struct phylink_link_state *state,
f392a184648972 Russell King (Oracle 2022-10-17 576) unsigned long mac_capabilities)
34ae2c09d46a2d Russell King (Oracle 2021-11-15 577) {
34ae2c09d46a2d Russell King (Oracle 2021-11-15 578) __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
3e6eab8f3ef93c Sean Anderson 2022-09-20 579 unsigned long caps;
34ae2c09d46a2d Russell King (Oracle 2021-11-15 580)
34ae2c09d46a2d Russell King (Oracle 2021-11-15 581) phylink_set_port_modes(mask);
34ae2c09d46a2d Russell King (Oracle 2021-11-15 582) phylink_set(mask, Autoneg);
f392a184648972 Russell King (Oracle 2022-10-17 @583) caps = phylink_get_capabilities(state->interface, mac_capabilities,
^^^^^^^^^^^^^^^^
b7e9294885b610 Sean Anderson 2022-09-20 584 state->rate_matching);
^^^^^^^^^^^^^^^^^^^^
Unchecked dereferences
3e6eab8f3ef93c Sean Anderson 2022-09-20 585 phylink_caps_to_linkmodes(mask, caps);
34ae2c09d46a2d Russell King (Oracle 2021-11-15 586)
34ae2c09d46a2d Russell King (Oracle 2021-11-15 587) linkmode_and(supported, supported, mask);
f392a184648972 Russell King (Oracle 2022-10-17 @588) if (state)
^^^^^
Check for NULL
34ae2c09d46a2d Russell King (Oracle 2021-11-15 589) linkmode_and(state->advertising, state->advertising, mask);
34ae2c09d46a2d Russell King (Oracle 2021-11-15 590) }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next reply other threads:[~2022-10-24 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 14:30 Dan Carpenter [this message]
2022-10-24 17:13 ` [linux-next:master 2112/3285] drivers/net/phy/phylink.c:588 phylink_validate_mask_caps() warn: variable dereferenced before check 'state' (see line 583) Sean Anderson
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=202210242228.KXXNz0bU-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=sean.anderson@seco.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).