Thread (13 messages) 13 messages, 6 authors, 2025-10-06

Re: [PATCH net-next v29 3/3] mctp pcc: Implement MCTP over PCC Transport

From: Simon Horman <horms@kernel.org>
Date: 2025-09-26 14:16:54
Also in: lkml

On Thu, Sep 25, 2025 at 03:00:26PM -0400, Adam Young wrote:

...
+static int initialize_MTU(struct net_device *ndev)
+{
+	struct mctp_pcc_ndev *mctp_pcc_ndev = netdev_priv(ndev);
+	struct mctp_pcc_mailbox *outbox;
+	int mctp_pcc_mtu;
+
+	outbox = &mctp_pcc_ndev->outbox;
+	outbox->chan = pcc_mbox_request_channel(&outbox->client, outbox->index);
+	mctp_pcc_mtu = outbox->chan->shmem_size - sizeof(struct pcc_header);
Hi Adam,

On the line below it is expected that outbox->chan may be an error value
rather than a valid pointer. But on the line above outbox->chan is
dereferenced.

This does not seem consistent.

Flagged by Smatch.
+	if (IS_ERR(outbox->chan))
+		return PTR_ERR(outbox->chan);
+
+	pcc_mbox_free_channel(mctp_pcc_ndev->outbox.chan);
+
+	mctp_pcc_ndev = netdev_priv(ndev);
+	ndev->mtu = MCTP_MIN_MTU;
+	ndev->max_mtu = mctp_pcc_mtu;
+	ndev->min_mtu = MCTP_MIN_MTU;
+
+	return 0;
+}
...

-- 
pw-bot: changes-requested
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help