Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4631620pxk; Wed, 30 Sep 2020 07:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSCFEclh9ptwjJ7x/K1LTimfIVDNZ8Wwivr0BqD9o/ZjdLGqA+4UdKU32McwVaK3ejc7hN X-Received: by 2002:a17:906:270f:: with SMTP id z15mr3174931ejc.6.1601477686888; Wed, 30 Sep 2020 07:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601477686; cv=none; d=google.com; s=arc-20160816; b=xYaAkJH7oV5S3s+88y+9dTiEQKbC9RTlB8VdjcQfdPImC6S0u+GvDJpAA9o0ic3gXi Ft3e8A69Z3TbVvWM/ZZ6tM9C9JjHw07lCzxARdFeFNE1hQR5H3t+J0cQCEJlrhgmxNOE P5qiS9yon2Wr12QSVV9U9/Q9zh0eP8HJCD9Sz2Z37OH7d4FeQ+ne44rk1ZILPDlBGA2H J3vVfh+4BoslBkpP+HHYYH2vMcjZam2jtDJzoyxWKeMnt2+G9xWk59CCP6WLgTIpJvZg M8py1PJMKvT+FJyW8wqPS0EIfXbP1siezjt+0gvF310AscbWZ4v0k6XVRZBmjHBuJ8Lp xDvA== 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=CeP+lW4WsAlHmU88XnJnZr3TR78/5TcW8+XvTKy8ZwU=; b=QfJwggxqO5F/3Ca7tOeYHckQKxnkPGJKZ/EhiQQ90GEv7RC1Quc1O1bv++kGJ8yMrd g7pv/LVXfdNaI3ZvlKoc94eHhH+lml9sfVO8zCgVRWI24koT7/IIZfWAZZtCWic+HK4I vwmxURgl0IRKPtONcCR42QckVTgGiBf6mxQC2DG6KuQK9+tbsMlvB9ECdwy4RYWPA9E6 HYOy2h7OrUi0vaGsB8p3lIftf5pJTEpHzOIA4oTVQ9QP/7mxktASZ3AwOsI87KvSNFtz yiFF9vSNPal7itgK56+x6tUonzJ3SbvXWYfY4uzzXfB7ACTZKpVhFDccSnNniYOIrXcD wVlw== 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 lx3si1304458ejb.306.2020.09.30.07.54.23; Wed, 30 Sep 2020 07:54:46 -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 S1730680AbgI3OxO (ORCPT + 99 others); Wed, 30 Sep 2020 10:53:14 -0400 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:44986 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730247AbgI3OxN (ORCPT ); Wed, 30 Sep 2020 10:53:13 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d69 with ME id aEsz2300N2lQRaH03Et73J; Wed, 30 Sep 2020 16:53:12 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Wed, 30 Sep 2020 16:53:12 +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 , Arunachalam Santhanam , Masahiro Yamada , linux-usb@vger.kernel.org (open list:USB ACM DRIVER) Subject: [PATCH v2 3/6] can: dev: __can_get_echo_skb(): fix the return length Date: Wed, 30 Sep 2020 23:45:30 +0900 Message-Id: <20200930144602.10290-4-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200926175810.278529-1-mailhol.vincent@wanadoo.fr> References: <20200926175810.278529-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 --- 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