Received: by 2002:a4f:b056:0:0:0:0:0 with SMTP id m22csp1383337ivi; Fri, 2 Oct 2020 08:51:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYBd5PwexMJMaqUXQpTVE4c2Db38ASjY7kQgs3UsKOaAnldRPrncC05khhuOJ81xta0lXE X-Received: by 2002:a50:99d6:: with SMTP id n22mr3036173edb.265.1601653885580; Fri, 02 Oct 2020 08:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601653885; cv=none; d=google.com; s=arc-20160816; b=mD+81P8YlfFASytMdcXsRj3j+zksGr0A1BO59tsBa7F3Xb6xXPZ1g96vYwzXSPifSH A6q5hdYvYW4WxAtaXWTAxRAeFFFPb4H6UT+AlTocEt5D/QUujjxZcTkeAAV3Ms5vGGcN 99/rvZyolqDCUk/DwmUTwT4axCEsUnm8p78m6BgVWWTILnTxrxvSb68Of1q6aATLYFgQ OqFtlYVlms3KYP3OErhZV1p8AvDasYmcWRsoMCq7LBPWLrPzg2PaaowFqSXxXTwG5+ZZ jaHi11x6zG6t/BId9X+gTwdyqe1i/NNP4zukolB8SZUaA+2brJ+h0jrh4W9hAcIUmSa+ gR0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=av7PO6iNpEDwtTEkZTt/1FDUq8n3EvrTvp93AVPCzE4=; b=KDNrk+ht1P00B3JKv5ePw0zeC0Np+SfsmIv7fK47hqCgmZkoFDGTB70yqCQR+CE+Rx O9t6/hx8ctDudUNe7S4MOXCfvOYomsKx+Kqjj1t8rs0qsFJsWh0+IwRdap4oGQP34vwP +7TQW0/Z6qGyLl2p80WNCSrszJRnv0jbuYMH+upTRTH5gu9U1X9rmbJJYZAO/wqLb+e5 fZ+AtyA6r2YcRQYSU91Dp/4thiWAQiYp+eXwxc7FcLSyw9sv02u7bFiQWigTWjdcDvRw 4Wts9naNzQK4Fl4ygvW+dERki8JCCkBJipx0jh46hgdgvILcXk8WCCRzljUGzAVnQot0 W+zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di24si1172802edb.608.2020.10.02.08.51.03; Fri, 02 Oct 2020 08:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388068AbgJBPt6 (ORCPT + 99 others); Fri, 2 Oct 2020 11:49:58 -0400 Received: from smtp13.smtpout.orange.fr ([80.12.242.135]:16934 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733260AbgJBPt6 (ORCPT ); Fri, 2 Oct 2020 11:49:58 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d76 with ME id b3pm230052lQRaH033psje; Fri, 02 Oct 2020 17:49:57 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Fri, 02 Oct 2020 17:49:57 +0200 X-ME-IP: 153.230.197.127 From: Vincent Mailhol To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-can@vger.kernel.org, Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Jakub Kicinski Cc: Vincent Mailhol , Oliver Neukum , Greg Kroah-Hartman , Masahiro Yamada , Arunachalam Santhanam , linux-usb@vger.kernel.org (open list:USB ACM DRIVER) Subject: [PATCH v3 4/7] can: dev: __can_get_echo_skb(): fix the return length Date: Sat, 3 Oct 2020 00:41:48 +0900 Message-Id: <20201002154219.4887-5-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201002154219.4887-1-mailhol.vincent@wanadoo.fr> References: <20200926175810.278529-1-mailhol.vincent@wanadoo.fr> <20201002154219.4887-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The length of Remote Transmission Request (RTR) frames is always 0 bytes. The DLC represents the requested length, not the actual length of the RTR. But __can_get_echo_skb() returns the DLC value regardless. Apply get_can_len() function to retrieve the correct length. Signed-off-by: Vincent Mailhol --- Changes in v3: None Changes in v2: None --- drivers/net/can/dev.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index e291fda395a0..8c3e11820e03 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -481,14 +481,9 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) } if (priv->echo_skb[idx]) { - /* Using "struct canfd_frame::len" for the frame - * length is supported on both CAN and CANFD frames. - */ struct sk_buff *skb = priv->echo_skb[idx]; - struct canfd_frame *cf = (struct canfd_frame *)skb->data; - u8 len = cf->len; - *len_ptr = len; + *len_ptr = get_can_len(skb); priv->echo_skb[idx] = NULL; return skb; -- 2.26.2