Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1378118pxu; Fri, 16 Oct 2020 10:25:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx70e6Dro7PpQ4DUJSyBChRRFQrBMhAKbCrwsDE+zkkSbYEUQkoubPceJNqdMMbglyNPZZB X-Received: by 2002:a17:906:aecf:: with SMTP id me15mr5087204ejb.423.1602869103630; Fri, 16 Oct 2020 10:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602869103; cv=none; d=google.com; s=arc-20160816; b=GmJpX/g3s5yRXXri6RH/qTWBnbaBEZICWi9S+/0PlNyE3P0ekKdySNhQDVMCMhZpQ8 v5ZztQUH94xSaaKxM3gE2zDUioiVwi8nUYyrw/k+7rxV7WIMntalaOnVCMSGO3bjDNT0 8MmVK79zao7Q+wTMixFhtAyuc7On+2UOFHvtSxhkl08cQ2YTJpz7JZetMZU2lHCyM2DS mEiEPWlmYEVosV1520LTOhggBGy4APkiWdvQdYTaSpH0hf9uW/s6gvfydo3JWu/tFfdb 7bXF4y8mqJkQboOameRI7mSEyP0gRokQJB8DAbMj2hWx/V+0iPpNxPWxLQOwmvWgvJ0o M4mg== 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=NtbES9BcCCbgChTjCOqMlF4jxZ+Yx9YyIaw/W76Dxqc=; b=iMkE6RIAanUkOCHpuv9sHwj3bqxttDg9zrNuQWP8Fhmbt0H0brlF4AHNrc3Q7qHbSP dD5X9MQvNca98ZGS++sZr1BjhWIYwaWvZUaz6B19UK/TaUY+/OmfvSZEVSyvFtq03qjL PwEpCxCO7FFQ/lBWROh0n0LbI8UOyFfOZz4njwlAZ29cddG0SluydoJp3qcR5Qykd2R+ udaYTmT1R1lO98agjc13wDdNPxTFFmfmomVCq7UwJp0fgr/BQ8TkbrY2/7XHj0WCDRRU +CuJSLx0z/vfED2w8K/IwdFShHNvK1eWw+MojNMx/dhoOtZhRvgBnaTmGjtU6xHy17OQ Bggg== 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 p17si2141262edy.143.2020.10.16.10.24.41; Fri, 16 Oct 2020 10:25:03 -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 S2390635AbgJPRXL (ORCPT + 99 others); Fri, 16 Oct 2020 13:23:11 -0400 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:28907 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390479AbgJPRXL (ORCPT ); Fri, 16 Oct 2020 13:23:11 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d44 with ME id ghNj2300m2lQRaH03hP5Kz; Fri, 16 Oct 2020 19:23:09 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Fri, 16 Oct 2020 19:23:09 +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, Marc Kleine-Budde , Wolfgang Grandegger , "David S. Miller" , Jakub Kicinski Cc: Arunachalam Santhanam , Vincent Mailhol , Masahiro Yamada Subject: [PATCH v4 3/4] can: dev: __can_get_echo_skb(): fix the return length Date: Sat, 17 Oct 2020 02:22:11 +0900 Message-Id: <20201016172240.229359-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201016171402.229001-1-mailhol.vincent@wanadoo.fr> References: <20201016171402.229001-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 v2 to v4: 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 73cfcd7e9517..8f91d23c1ca7 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -507,14 +507,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