diff mbox series

[v3,1/4] can: slcan: use can_dropped_invalid_skb() instead of manual check

Message ID 20220514141650.1109542-2-mailhol.vincent@wanadoo.fr (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series can: can_dropped_invalid_skb() and Kbuild changes | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Vincent Mailhol May 14, 2022, 2:16 p.m. UTC
slcan does a manual check in slc_xmit() to verify if the skb is
valid. This check is incomplete, use instead
can_dropped_invalid_skb().

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 drivers/net/can/slcan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc Kleine-Budde May 16, 2022, 8:40 p.m. UTC | #1
On 14.05.2022 23:16:47, Vincent Mailhol wrote:
> slcan does a manual check in slc_xmit() to verify if the skb is
> valid. This check is incomplete, use instead
> can_dropped_invalid_skb().
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

I've taken this patch into the latest pull request to net-next.

regards,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 27783fbf011f..1879b50391ee 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -359,8 +359,8 @@  static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct slcan *sl = netdev_priv(dev);
 
-	if (skb->len != CAN_MTU)
-		goto out;
+	if (can_dropped_invalid_skb(dev, skb))
+		return NETDEV_TX_OK;
 
 	spin_lock(&sl->lock);
 	if (!netif_running(dev))  {