[arm:zii 70/161] drivers/net/phy/phylink.c:1287 phylink_set_pcs() error: we previously assumed 'pcs' could be null (see line 1283)
From: Dan Carpenter <hidden>
Date: 2021-11-29 09:16:01
Also in:
oe-kbuild, oe-kbuild-all
tree: git://git.armlinux.org.uk/~rmk/linux-arm.git zii head: 1c86335a03ee0102daaefede1fb25cdbb367b14c commit: 8eca4525ad01e4504dba39f4783f9d5885243941 [70/161] net: phylink: add mac_select_pcs() method to phylink_mac_ops config: s390-randconfig-m031-20211124 (https://download.01.org/0day-ci/archive/20211125/202111252259.X7Tr9l1K-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <redacted> Reported-by: Dan Carpenter <redacted> New smatch warnings: drivers/net/phy/phylink.c:1287 phylink_set_pcs() error: we previously assumed 'pcs' could be null (see line 1283) Old smatch warnings: drivers/net/phy/phylink.c:850 phylink_change_inband_advert() error: we previously assumed 'pl->pcs_ops' could be null (see line 833) vim +/pcs +1287 drivers/net/phy/phylink.c 7137e18f6f889a Russell King 2020-07-21 1274 void phylink_set_pcs(struct phylink *pl, struct phylink_pcs *pcs) 4c0d6d3a7a81fc Russell King 2020-03-30 1275 { b01e3d443ba5bd Russell King (Oracle 2021-11-22 1276) if (pl->config->legacy_pre_march2020 && pl->pcs && !pcs) { b01e3d443ba5bd Russell King (Oracle 2021-11-22 1277) phylink_warn(pl, b01e3d443ba5bd Russell King (Oracle 2021-11-22 1278) "Removing PCS is not supported in a legacy driver"); b01e3d443ba5bd Russell King (Oracle 2021-11-22 1279) return; b01e3d443ba5bd Russell King (Oracle 2021-11-22 1280) } b01e3d443ba5bd Russell King (Oracle 2021-11-22 1281) 7137e18f6f889a Russell King 2020-07-21 1282 pl->pcs = pcs; b01e3d443ba5bd Russell King (Oracle 2021-11-22 @1283) pl->pcs_ops = pcs ? pcs->ops : NULL; ^^^ Check for NULL 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1284) 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1285) if (!pl->phylink_disable_state && 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1286) pl->cfg_link_an_mode == MLO_AN_INBAND) { 8eca4525ad01e4 Russell King (Oracle 2021-10-07 @1287) if (pl->config->pcs_poll || pcs->poll) ^^^^^^^^^ Unchecked dereference 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1288) mod_timer(&pl->link_poll, jiffies + HZ); 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1289) else 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1290) del_timer(&pl->link_poll); 8eca4525ad01e4 Russell King (Oracle 2021-10-07 1291) } 4c0d6d3a7a81fc Russell King 2020-03-30 1292 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel