All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] net: pcs: xpcs: convert to phylink_pcs_ops
@ 2021-06-08 12:23 Dan Carpenter
  2021-06-08 12:37 ` Vladimir Oltean
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-06-08 12:23 UTC (permalink / raw)
  To: vladimir.oltean; +Cc: kernel-janitors

Hello Vladimir Oltean,

The patch 11059740e616: "net: pcs: xpcs: convert to phylink_pcs_ops"
from Jun 2, 2021, leads to the following static checker warning:

	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237 stmmac_phy_setup()
	error: we previously assumed 'mdio_bus_data' could be null (see line 1225)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  1215  static int stmmac_phy_setup(struct stmmac_priv *priv)
  1216  {
  1217          struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1218          struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
  1219          int mode = priv->plat->phy_interface;
  1220          struct phylink *phylink;
  1221  
  1222          priv->phylink_config.dev = &priv->dev->dev;
  1223          priv->phylink_config.type = PHYLINK_NETDEV;
  1224          priv->phylink_config.pcs_poll = true;
  1225          if (priv->plat->mdio_bus_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
This old code assumes mdio_bus_data can be NULL.

  1226                  priv->phylink_config.ovr_an_inband =
  1227                          mdio_bus_data->xpcs_an_inband;
  1228  
  1229          if (!fwnode)
  1230                  fwnode = dev_fwnode(priv->device);
  1231  
  1232          phylink = phylink_create(&priv->phylink_config, fwnode,
  1233                                   mode, &stmmac_phylink_mac_ops);
  1234          if (IS_ERR(phylink))
  1235                  return PTR_ERR(phylink);
  1236  
  1237          if (mdio_bus_data->has_xpcs) {
                    ^^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference.

  1238                  struct mdio_xpcs_args *xpcs = priv->hw->xpcs;
  1239  
  1240                  phylink_set_pcs(phylink, &xpcs->pcs);
  1241          }
  1242  
  1243          priv->phylink = phylink;
  1244          return 0;
  1245  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] net: pcs: xpcs: convert to phylink_pcs_ops
  2021-06-08 12:23 [bug report] net: pcs: xpcs: convert to phylink_pcs_ops Dan Carpenter
@ 2021-06-08 12:37 ` Vladimir Oltean
  2021-06-08 12:54   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2021-06-08 12:37 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors@vger.kernel.org

Hello Dan Carpenter,

On Tue, Jun 08, 2021 at 03:23:42PM +0300, Dan Carpenter wrote:
> Hello Vladimir Oltean,
> 
> The patch 11059740e616: "net: pcs: xpcs: convert to phylink_pcs_ops"
> from Jun 2, 2021, leads to the following static checker warning:
> 
> 	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237 stmmac_phy_setup()
> 	error: we previously assumed 'mdio_bus_data' could be null (see line 1225)
> 
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>   1215  static int stmmac_phy_setup(struct stmmac_priv *priv)
>   1216  {
>   1217          struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
>                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   1218          struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
>   1219          int mode = priv->plat->phy_interface;
>   1220          struct phylink *phylink;
>   1221  
>   1222          priv->phylink_config.dev = &priv->dev->dev;
>   1223          priv->phylink_config.type = PHYLINK_NETDEV;
>   1224          priv->phylink_config.pcs_poll = true;
>   1225          if (priv->plat->mdio_bus_data)
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^
> This old code assumes mdio_bus_data can be NULL.
> 
>   1226                  priv->phylink_config.ovr_an_inband =
>   1227                          mdio_bus_data->xpcs_an_inband;
>   1228  
>   1229          if (!fwnode)
>   1230                  fwnode = dev_fwnode(priv->device);
>   1231  
>   1232          phylink = phylink_create(&priv->phylink_config, fwnode,
>   1233                                   mode, &stmmac_phylink_mac_ops);
>   1234          if (IS_ERR(phylink))
>   1235                  return PTR_ERR(phylink);
>   1236  
>   1237          if (mdio_bus_data->has_xpcs) {
>                     ^^^^^^^^^^^^^^^^^^^^^^^
> Unchecked dereference.
> 
>   1238                  struct mdio_xpcs_args *xpcs = priv->hw->xpcs;
>   1239  
>   1240                  phylink_set_pcs(phylink, &xpcs->pcs);
>   1241          }
>   1242  
>   1243          priv->phylink = phylink;
>   1244          return 0;
>   1245  }
> 
> regards,
> dan carpenter

This should be solved here:
https://lore.kernel.org/netdev/20210604112825.011148a3@canb.auug.org.au/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] net: pcs: xpcs: convert to phylink_pcs_ops
  2021-06-08 12:37 ` Vladimir Oltean
@ 2021-06-08 12:54   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-06-08 12:54 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: kernel-janitors@vger.kernel.org

On Tue, Jun 08, 2021 at 12:37:08PM +0000, Vladimir Oltean wrote:
> Hello Dan Carpenter,
> 
> On Tue, Jun 08, 2021 at 03:23:42PM +0300, Dan Carpenter wrote:
> > Hello Vladimir Oltean,
> > 
> > The patch 11059740e616: "net: pcs: xpcs: convert to phylink_pcs_ops"
> > from Jun 2, 2021, leads to the following static checker warning:
> > 
> > 	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1237 stmmac_phy_setup()
> > 	error: we previously assumed 'mdio_bus_data' could be null (see line 1225)
> > 
> > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> >   1215  static int stmmac_phy_setup(struct stmmac_priv *priv)
> >   1216  {
> >   1217          struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
> >                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >   1218          struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
> >   1219          int mode = priv->plat->phy_interface;
> >   1220          struct phylink *phylink;
> >   1221  
> >   1222          priv->phylink_config.dev = &priv->dev->dev;
> >   1223          priv->phylink_config.type = PHYLINK_NETDEV;
> >   1224          priv->phylink_config.pcs_poll = true;
> >   1225          if (priv->plat->mdio_bus_data)
> >                     ^^^^^^^^^^^^^^^^^^^^^^^^^
> > This old code assumes mdio_bus_data can be NULL.
> > 
> >   1226                  priv->phylink_config.ovr_an_inband =
> >   1227                          mdio_bus_data->xpcs_an_inband;
> >   1228  
> >   1229          if (!fwnode)
> >   1230                  fwnode = dev_fwnode(priv->device);
> >   1231  
> >   1232          phylink = phylink_create(&priv->phylink_config, fwnode,
> >   1233                                   mode, &stmmac_phylink_mac_ops);
> >   1234          if (IS_ERR(phylink))
> >   1235                  return PTR_ERR(phylink);
> >   1236  
> >   1237          if (mdio_bus_data->has_xpcs) {
> >                     ^^^^^^^^^^^^^^^^^^^^^^^
> > Unchecked dereference.
> > 
> >   1238                  struct mdio_xpcs_args *xpcs = priv->hw->xpcs;
> >   1239  
> >   1240                  phylink_set_pcs(phylink, &xpcs->pcs);
> >   1241          }
> >   1242  
> >   1243          priv->phylink = phylink;
> >   1244          return 0;
> >   1245  }
> > 
> > regards,
> > dan carpenter
> 
> This should be solved here:
> https://lore.kernel.org/netdev/20210604112825.011148a3@canb.auug.org.au/ 

Nope.  That is a fix for merge conflict and it has been removed from
today's linux-next.  It's unrelated.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-08 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 12:23 [bug report] net: pcs: xpcs: convert to phylink_pcs_ops Dan Carpenter
2021-06-08 12:37 ` Vladimir Oltean
2021-06-08 12:54   ` Dan Carpenter

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.