lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CO1PR11MB477198373D836FC02B79F460E2FE9@CO1PR11MB4771.namprd11.prod.outlook.com>
Date:   Mon, 9 Jan 2023 03:37:52 +0000
From:   <Divya.Koppera@...rochip.com>
To:     <error27@...il.com>, <oe-kbuild@...ts.linux.dev>
CC:     <lkp@...el.com>, <oe-kbuild-all@...ts.linux.dev>,
        <linux-kernel@...r.kernel.org>
Subject: RE: drivers/net/phy/micrel.c:2613 lan8814_ptp_probe_once() warn:
 passing zero to 'PTR_ERR'

Hi,

I have given fix for below smatch warnings/errors, reviews are in progress. Please find below for reference

https://patchwork.kernel.org/project/netdevbpf/patch/20230106082905.1159-2-Divya.Koppera@microchip.com/
https://patchwork.kernel.org/project/netdevbpf/patch/20230106082905.1159-3-Divya.Koppera@microchip.com/

/Divya

> -----Original Message-----
> From: Dan Carpenter <error27@...il.com>
> Sent: Saturday, January 7, 2023 2:03 PM
> To: oe-kbuild@...ts.linux.dev; Divya Koppera - I30481
> <Divya.Koppera@...rochip.com>
> Cc: lkp@...el.com; oe-kbuild-all@...ts.linux.dev; linux-
> kernel@...r.kernel.org
> Subject: drivers/net/phy/micrel.c:2613 lan8814_ptp_probe_once() warn:
> passing zero to 'PTR_ERR'
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master
> head:   1f5abbd77e2c1787e74b7c2caffac97def78ba52
> commit: ece19502834d84ece2e056db28257ca2aa6e4d48 net: phy: micrel:
> 1588 support for LAN8814 phy
> config: arc-randconfig-m041-20230106
> compiler: arc-elf-gcc (GCC) 12.1.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <error27@...il.com>
> 
> New smatch warnings:
> drivers/net/phy/micrel.c:2613 lan8814_ptp_probe_once() warn: passing zero
> to 'PTR_ERR'
> 
> Old smatch warnings:
> drivers/net/phy/micrel.c:1750 ksz886x_cable_test_get_status() error:
> uninitialized symbol 'ret'.
> 
> vim +/PTR_ERR +2613 drivers/net/phy/micrel.c
> 
> ece19502834d84 Divya Koppera 2022-03-04  2589  static int
> lan8814_ptp_probe_once(struct phy_device *phydev)
> ece19502834d84 Divya Koppera 2022-03-04  2590  {
> ece19502834d84 Divya Koppera 2022-03-04  2591   struct lan8814_shared_priv
> *shared = phydev->shared->priv;
> ece19502834d84 Divya Koppera 2022-03-04  2592
> ece19502834d84 Divya Koppera 2022-03-04  2593   /* Initialise shared lock for
> clock*/
> ece19502834d84 Divya Koppera 2022-03-04  2594   mutex_init(&shared-
> >shared_lock);
> ece19502834d84 Divya Koppera 2022-03-04  2595
> ece19502834d84 Divya Koppera 2022-03-04  2596   shared-
> >ptp_clock_info.owner = THIS_MODULE;
> ece19502834d84 Divya Koppera 2022-03-04  2597   snprintf(shared-
> >ptp_clock_info.name, 30, "%s", phydev->drv->name);
> ece19502834d84 Divya Koppera 2022-03-04  2598   shared-
> >ptp_clock_info.max_adj = 31249999;
> ece19502834d84 Divya Koppera 2022-03-04  2599   shared-
> >ptp_clock_info.n_alarm = 0;
> ece19502834d84 Divya Koppera 2022-03-04  2600   shared-
> >ptp_clock_info.n_ext_ts = 0;
> ece19502834d84 Divya Koppera 2022-03-04  2601   shared-
> >ptp_clock_info.n_pins = 0;
> ece19502834d84 Divya Koppera 2022-03-04  2602   shared-
> >ptp_clock_info.pps = 0;
> ece19502834d84 Divya Koppera 2022-03-04  2603   shared-
> >ptp_clock_info.pin_config = NULL;
> ece19502834d84 Divya Koppera 2022-03-04  2604   shared-
> >ptp_clock_info.adjfine = lan8814_ptpci_adjfine;
> ece19502834d84 Divya Koppera 2022-03-04  2605   shared-
> >ptp_clock_info.adjtime = lan8814_ptpci_adjtime;
> ece19502834d84 Divya Koppera 2022-03-04  2606   shared-
> >ptp_clock_info.gettime64 = lan8814_ptpci_gettime64;
> ece19502834d84 Divya Koppera 2022-03-04  2607   shared-
> >ptp_clock_info.settime64 = lan8814_ptpci_settime64;
> ece19502834d84 Divya Koppera 2022-03-04  2608   shared-
> >ptp_clock_info.getcrosststamp = NULL;
> ece19502834d84 Divya Koppera 2022-03-04  2609
> ece19502834d84 Divya Koppera 2022-03-04  2610   shared->ptp_clock =
> ptp_clock_register(&shared->ptp_clock_info,
> ece19502834d84 Divya Koppera 2022-03-04  2611
> &phydev->mdio.dev);
> ece19502834d84 Divya Koppera 2022-03-04  2612   if
> (IS_ERR_OR_NULL(shared->ptp_clock)) {
> ece19502834d84 Divya Koppera 2022-03-04 @2613           phydev_err(phydev,
> "ptp_clock_register failed %lu\n",
> ece19502834d84 Divya Koppera 2022-03-04  2614                      PTR_ERR(shared-
> >ptp_clock));
> ece19502834d84 Divya Koppera 2022-03-04  2615           return -EINVAL;
> 
> I sent a detailed explanation of this bug earlier but it still has not been fixed.
> Search lore.kernel.org for more info.
> 
> ece19502834d84 Divya Koppera 2022-03-04  2616   }
> ece19502834d84 Divya Koppera 2022-03-04  2617
> ece19502834d84 Divya Koppera 2022-03-04  2618   phydev_dbg(phydev,
> "successfully registered ptp clock\n");
> ece19502834d84 Divya Koppera 2022-03-04  2619
> ece19502834d84 Divya Koppera 2022-03-04  2620   shared->phydev = phydev;
> ece19502834d84 Divya Koppera 2022-03-04  2621
> ece19502834d84 Divya Koppera 2022-03-04  2622   /* The EP.4 is shared
> between all the PHYs in the package and also it
> ece19502834d84 Divya Koppera 2022-03-04  2623    * can be accessed by any
> of the PHYs
> ece19502834d84 Divya Koppera 2022-03-04  2624    */
> ece19502834d84 Divya Koppera 2022-03-04  2625
> lanphy_write_page_reg(phydev, 4, LTC_HARD_RESET, LTC_HARD_RESET_);
> ece19502834d84 Divya Koppera 2022-03-04  2626
> lanphy_write_page_reg(phydev, 4, PTP_OPERATING_MODE,
> ece19502834d84 Divya Koppera 2022-03-04  2627
> PTP_OPERATING_MODE_STANDALONE_);
> ece19502834d84 Divya Koppera 2022-03-04  2628
> ece19502834d84 Divya Koppera 2022-03-04  2629   return 0;
> ece19502834d84 Divya Koppera 2022-03-04  2630  }
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ