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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 4 Apr 2017 21:14:53 +0200
From:   Thierry Reding <treding@...dia.com>
To:     Joao Pinto <Joao.Pinto@...opsys.com>
CC:     <davem@...emloft.net>, <clabbe.montjoie@...il.com>,
        <niklas.cassel@...s.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/4] net: stmmac: adding multiple buffers for rx

On Tue, Apr 04, 2017 at 06:54:25PM +0100, Joao Pinto wrote:
[...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[...]
>  static void stmmac_display_rx_rings(struct stmmac_priv *priv)
>  {
> +	u32 rx_cnt = priv->plat->rx_queues_to_use;
>  	void *head_rx;
> +	u32 queue;
>  
> -	if (priv->extend_desc)
> -		head_rx = (void *)priv->dma_erx;
> -	else
> -		head_rx = (void *)priv->dma_rx;
> +	/* Display RX rings */
> +	for (queue = 0; queue < rx_cnt; queue++) {
> +		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
>  
> -	/* Display RX ring */
> -	priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
> +		pr_info("\tRX Queue %d rings\n", queue);

Nit: %u is the right specifier for unsigned integers.

> @@ -1107,46 +1135,65 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
[...]
>  err_init_rx_buffers:
> -	while (--i >= 0)
> -		stmmac_free_rx_buffers(priv, i);
> +	while (queue-- >= 0) {

Why are you switching to postfix decrement here? Not only is it
inconsistent with the prefix decrement below, I think this also gives
you a wrong result. Consider what happens if queue == 0. The condition
evaluates to true, but within the loop the queue variable will wrap to
~0 and probably crash stmmac_free_rx_buffers().

Other than that, this looks fine, so with the above fixed:

Reviewed-by: Thierry Reding <treding@...dia.com>

Also works on Tegra186, so:

Tested-by: Thierry Reding <treding@...dia.com>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ