Message ID | 20210710192602.2186370-4-colin.foster@in-advantage.com |
---|---|
State | New |
Headers | show |
Series | Add support for VSC7511-7514 chips over SPI | expand |
On Sat, Jul 10, 2021 at 12:25:57PM -0700, Colin Foster wrote: > Add NULL check before dereferencing array > > Signed-off-by: Colin Foster <colin.foster@in-advantage.com> > --- The patch is correct but is insufficiently documented. In particular, people might interpret it as a bug fix and backport it to stable kernels.
On Sat, Jul 10, 2021 at 11:06:28PM +0300, Vladimir Oltean wrote: > On Sat, Jul 10, 2021 at 12:25:57PM -0700, Colin Foster wrote: > > Add NULL check before dereferencing array > > > > Signed-off-by: Colin Foster <colin.foster@in-advantage.com> > > --- > > The patch is correct but is insufficiently documented. In particular, > people might interpret it as a bug fix and backport it to stable > kernels. That makes sense. I'll clarify that it is only something that'll affect future drivers and not a bug fix.
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index ce607fbaaa3a..74ae322b2126 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -852,7 +852,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct felix *felix = ocelot_to_felix(ocelot); struct dsa_port *dp = dsa_to_port(ds, port); - if (felix->pcs[port]) + if (felix->pcs && felix->pcs[port]) phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); }
Add NULL check before dereferencing array Signed-off-by: Colin Foster <colin.foster@in-advantage.com> --- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)