lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed755990-4169-604e-d982-7e4370114512@hartkopp.net>
Date:   Thu, 25 Nov 2021 19:50:01 +0100
From:   Oliver Hartkopp <socketcan@...tkopp.net>
To:     Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        linux-can@...r.kernel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
        Jimmy Assarsson <extja@...ser.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
        Maxime Ripard <mripard@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Yasushi SHOJI <yashi@...cecubics.com>,
        Appana Durga Kedareswara rao <appana.durga.rao@...inx.com>,
        Naga Sureshkumar Relli <naga.sureshkumar.relli@...inx.com>,
        Michal Simek <michal.simek@...inx.com>,
        Stephane Grosjean <s.grosjean@...k-system.com>
Subject: Re: [PATCH v2 4/5] can: do not increase rx_bytes statistics for RTR
 frames

Hi Vincent,

On 25.11.21 18:20, Vincent Mailhol wrote:

> diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
> index d582c39fc8d0..717d4925fdb0 100644
> --- a/drivers/net/can/usb/ucan.c
> +++ b/drivers/net/can/usb/ucan.c
> @@ -619,12 +619,13 @@ static void ucan_rx_can_msg(struct ucan_priv *up, struct ucan_message_in *m)
>   	/* copy the payload of non RTR frames */
>   	if (!(cf->can_id & CAN_RTR_FLAG) || (cf->can_id & CAN_ERR_FLAG))
>   		memcpy(cf->data, m->msg.can_msg.data, cf->len);
> +	/* only frames which are neither RTR nor ERR have a payload */
> +	else
> +		stats->rx_bytes += cf->len;

This 'else' path looks wrong ...

>   
>   	/* don't count error frames as real packets */
> -	if (!(cf->can_id & CAN_ERR_FLAG)) {
> +	if (!(cf->can_id & CAN_ERR_FLAG))
>   		stats->rx_packets++;
> -		stats->rx_bytes += cf->len;
> -	}
>   
>   	/* pass it to Linux */
>   	netif_rx(skb);

Regards,
Oliver

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ