Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1955135pxk; Sat, 26 Sep 2020 10:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr9+kNv8mCvqcRHk0uPSnSbsADHDgWphpQahsE1ykkJfcKylJPI1PGbNSK2eWANLC7SnzQ X-Received: by 2002:a17:906:6b95:: with SMTP id l21mr7988780ejr.317.1601142600828; Sat, 26 Sep 2020 10:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601142600; cv=none; d=google.com; s=arc-20160816; b=kjPsEJucqMcWILDwiRYeorvypiSDNYanWvg6rBMZfBuQF0BKKa8KgkI0BOuoTrVX9X c/gd8HMvMUKkgkP03GTPSug71jm15q4EzmdijtwG2+ZBt4ZNC4o72QLh9LrGivEfh3Yr Nd5WRe9hpRfZ5B4TYDPfP1+AKO0uwbiHIBIUlEQgr98U+Fnjv8MOcPu5tULpemimMxjV Mu4U2RmhWlByRQpOEJwILldeA2gkI4PU2f7M0HSLIH6/tzSz8OWZMUtaEzg5WbjGS9HP O7To9tDeUxdEhTya7nFkPJRgsd3kh+ZBkSS2+V3YUriOFPcZCwMj3kNWxRXkOOyskTWK Frtw== 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=wxAa21axc9W0dlF9DYr2GLoVxgKvmuj82SDFx98DMDOf75lrKl4v0fWHHX81c0av+v EXQp1utCF9aN4LorRHLM1DIuygu8yGyXsXiuW3snVYgh0IAneM8tCOkl1wTEM19N5zsG nmdU+QrYoPcGtbiuD9Yf9ZZGOmmDYD1qkDG8IpM7CAJO6diI6eVxBD0EvoWaMQ9MAXY+ r6+gC/SC9UiSQiz6Ea+tDTmOaRpyk+aXsgJS3Tt4k8lGh5xB8iuAlL69wRNXhDpfGXcZ xWHEn84sj9rdhyCtdAViahJxQWWYQyAhm88FuSp/1VnyZgTIJE7rU0RC4tb5zVHIg/yH XZ0Q== 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 a5si4512341edt.556.2020.09.26.10.49.38; Sat, 26 Sep 2020 10:50:00 -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 S1730000AbgIZRqW (ORCPT + 99 others); Sat, 26 Sep 2020 13:46:22 -0400 Received: from smtp11.smtpout.orange.fr ([80.12.242.133]:55809 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729993AbgIZRqU (ORCPT ); Sat, 26 Sep 2020 13:46:20 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d89 with ME id Yhlm230082lQRaH03hmF5X; Sat, 26 Sep 2020 19:46:18 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sat, 26 Sep 2020 19:46:18 +0200 X-ME-IP: 153.230.197.127 From: Vincent Mailhol To: linux-can@vger.kernel.org, Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" Cc: Vincent Mailhol , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] can: dev: __can_get_echo_skb(): fix the return length Date: Sun, 27 Sep 2020 02:45:33 +0900 Message-Id: <20200926174542.278166-4-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200926174542.278166-1-mailhol.vincent@wanadoo.fr> References: <20200926174542.278166-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