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] [day] [month] [year] [list]
Date:	Sat, 14 Mar 2015 13:48:55 +0900
From:	Jaedon Shin <jaedon.shin@...il.com>
To:	Florian Fainelli <f.fainelli@...il.com>
Cc:	netdev@...r.kernel.org, edumazet@...gle.com, davem@...emloft.net,
	pgynther@...gle.com
Subject: Re: [PATCH net-next 1/2] net: bcmgenet: use skb_put_padto()


> On Mar 14, 2015, at 7:58 AM, Florian Fainelli <f.fainelli@...il.com> wrote:
> 
> We use skb_pad() to pad small packets, and then we need to enforce again
> in bcmgenet_xmit() a check on ETH_ZLEN. Use skb_put_padto() which pads
> up to the specified length and also increases skb->len accordingly. Note
> that we still need to use skb_headlen() since we might transmitting the
> first part out of a train of fragments.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
> ---
> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index e74ae628bbb9..cee86c24b35f 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -1108,8 +1108,7 @@ static int bcmgenet_xmit_single(struct net_device *dev,
> 
> 	tx_cb_ptr->skb = skb;
> 
> -	skb_len = skb_headlen(skb) < ETH_ZLEN ? ETH_ZLEN : skb_headlen(skb);
> -
> +	skb_len = skb_headlen(skb);
> 	mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
> 	ret = dma_mapping_error(kdev, mapping);
> 	if (ret) {
> @@ -1272,7 +1271,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
> 		goto out;
> 	}
> 
> -	if (skb_padto(skb, ETH_ZLEN)) {
> +	if (skb_put_padto(skb, ETH_ZLEN)) {

I suggest to use the eth_skb_pad helper.

	if (eth_skb_pad(skb)) {
		dev->stats.tx_dropped++;
> 		ret = NETDEV_TX_OK;
> 		goto out;
> 	}
> -- 
> 2.1.0
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists