Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1960403pxk; Sat, 26 Sep 2020 11:03:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdVFjUEs97Bu5YgXvBiCvXo/To0lLKdB9Pn2FAw2flR23q150W+bH1Vlst6MSstarbTHnz X-Received: by 2002:aa7:d403:: with SMTP id z3mr7476381edq.310.1601143386321; Sat, 26 Sep 2020 11:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601143386; cv=none; d=google.com; s=arc-20160816; b=PZciw+39UEXcFSoXzJk6+riMKjlAVZmgNC1J2nMqqf3qPt825AlSSSq45oksrl/E89 tSCMDvJV4bIjIn/ZVpGaRJrpIm8AONd3qCPazLsMDnPYO47VyW3TY/HYNL+kb8IZwGlo hF6VNljy36vbRBsOme7TjwaQRLTI6g3NP35FkV08EWr1OLcLkK+1F7TBYYTAL7fLx0W5 38j9+1bwmP1VvX/wwrrITnzTJ8sHRAv6nZtpSabSqYS8IWh7yzJ0Zm2CT5Oc5GJ+FvOb qGEGWRpCZj0hMQ95g9GJxKz7V/kbiXn3eKaabuV6PS9PimOg8UQKG93gp7DtC0TIsEZt H6Jw== 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=rFkkhtpMm/CfKMfrc4w6D1L6itsUSlFXZaLbvyXkS8P1RmstdEwHbDwEOO+2UqcEnO kPYQDZta76rM2Co1CbH1sTMbu0ip2XN3O8gyzAp30gHpO6uf2iJpH5dShERjSe82a/3B 8eVAuF97Ll7RnfxNn0ddMmh9ITagvPlSu8QxM5MnD5ohJw6EkdADXSKK1gpnlSBvFRQd 2J5IHH2foI+uQtuIPt5hnYQhaHhsEjz6p7RVNMapuvO3i+0db6JmeBVemN/KLLSMQRQZ Xu/UPBjoPbHPb5M8Qb1S0+8Nn19kYDsAEl5hNlemt0YNnxVCORxGFYt74k5Pm0+ci5yj LZ7Q== 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 n21si4810178edr.327.2020.09.26.11.02.43; Sat, 26 Sep 2020 11:03:06 -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 S1730096AbgIZR7g (ORCPT + 99 others); Sat, 26 Sep 2020 13:59:36 -0400 Received: from smtp11.smtpout.orange.fr ([80.12.242.133]:18747 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729412AbgIZR7g (ORCPT ); Sat, 26 Sep 2020 13:59:36 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d89 with ME id YhyX2300D2lQRaH03hzX3C; Sat, 26 Sep 2020 19:59:34 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sat, 26 Sep 2020 19:59:34 +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" Cc: Vincent Mailhol , Jakub Kicinski Subject: [PATCH 3/6] can: dev: __can_get_echo_skb(): fix the return length Date: Sun, 27 Sep 2020 02:57:53 +0900 Message-Id: <20200926175810.278529-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