* [bug report] net: dsa: tag_ocelot_8021q: add support for PTP timestamping
@ 2021-02-19 9:54 Dan Carpenter
2021-02-19 10:42 ` Vladimir Oltean
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-02-19 9:54 UTC (permalink / raw)
To: vladimir.oltean; +Cc: kernel-janitors
Hello Vladimir Oltean,
The patch 0a6f17c6ae21: "net: dsa: tag_ocelot_8021q: add support for
PTP timestamping" from Feb 14, 2021, leads to the following static
checker warning:
drivers/net/dsa/ocelot/felix.c:1331 felix_check_xtr_pkt()
error: uninitialized symbol 'err'.
drivers/net/ethernet/mscc/ocelot_vsc7514.c:554 ocelot_xtr_irq_handler()
error: uninitialized symbol 'err'
drivers/net/dsa/ocelot/felix.c
1288 static bool felix_check_xtr_pkt(struct ocelot *ocelot, unsigned int ptp_type)
1289 {
1290 struct felix *felix = ocelot_to_felix(ocelot);
1291 int err, grp = 0;
1292
1293 if (felix->tag_proto != DSA_TAG_PROTO_OCELOT_8021Q)
1294 return false;
1295
1296 if (!felix->info->quirk_no_xtr_irq)
1297 return false;
1298
1299 if (ptp_type == PTP_CLASS_NONE)
1300 return false;
1301
1302 while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp)) {
What about if we don't ever enter this loop?
1303 struct sk_buff *skb;
1304 unsigned int type;
1305
1306 err = ocelot_xtr_poll_frame(ocelot, grp, &skb);
1307 if (err)
1308 goto out;
1309
1310 /* We trap to the CPU port module all PTP frames, but
1311 * felix_rxtstamp() only gets called for event frames.
1312 * So we need to avoid sending duplicate general
1313 * message frames by running a second BPF classifier
1314 * here and dropping those.
1315 */
1316 __skb_push(skb, ETH_HLEN);
1317
1318 type = ptp_classify_raw(skb);
1319
1320 __skb_pull(skb, ETH_HLEN);
1321
1322 if (type == PTP_CLASS_NONE) {
1323 kfree_skb(skb);
1324 continue;
1325 }
1326
1327 netif_rx(skb);
1328 }
1329
1330 out:
1331 if (err < 0)
1332 ocelot_drain_cpu_queue(ocelot, 0);
1333
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] net: dsa: tag_ocelot_8021q: add support for PTP timestamping
2021-02-19 9:54 [bug report] net: dsa: tag_ocelot_8021q: add support for PTP timestamping Dan Carpenter
@ 2021-02-19 10:42 ` Vladimir Oltean
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Oltean @ 2021-02-19 10:42 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors
Hi Dan,
On Fri, Feb 19, 2021 at 12:54:10PM +0300, Dan Carpenter wrote:
> What about if we don't ever enter this loop?
This is a real bug, thanks for reporting. It would be good if you could
initialize err with zero.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-19 10:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 9:54 [bug report] net: dsa: tag_ocelot_8021q: add support for PTP timestamping Dan Carpenter
2021-02-19 10:42 ` Vladimir Oltean
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).