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: <20180313.104405.1978125419404641583.davem@davemloft.net>
Date:   Tue, 13 Mar 2018 10:44:05 -0400 (EDT)
From:   David Miller <davem@...emloft.net>
To:     subashab@...eaurora.org
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/4] net: qualcomm: rmnet: Fix casting issues

From: Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>
Date: Mon, 12 Mar 2018 20:26:06 -0600

> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> index 6ce31e2..65b074e 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> @@ -44,7 +44,7 @@ struct rmnet_map_header {
>  	u8  reserved_bit:1;
>  	u8  cd_bit:1;
>  	u8  mux_id;
> -	u16 pkt_len;
> +	__be16 pkt_len;
>  }  __aligned(1);
>  
>  struct rmnet_map_dl_csum_trailer {
 ...
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> index c74a6c5..4e342a3 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> @@ -307,7 +307,8 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
>  		return NULL;
>  
>  	maph = (struct rmnet_map_header *)skb->data;
> -	packet_len = ntohs(maph->pkt_len) + sizeof(struct rmnet_map_header);
> +	packet_len = ntohs((__force __be16)maph->pkt_len) +
> +		     sizeof(struct rmnet_map_header);
>  
>  	if (port->data_format & RMNET_INGRESS_FORMAT_MAP_CKSUMV4)
>  		packet_len += sizeof(struct rmnet_map_dl_csum_trailer);
> @@ -316,7 +317,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
>  		return NULL;
>  
>  	/* Some hardware can send us empty frames. Catch them */
> -	if (ntohs(maph->pkt_len) == 0)
> +	if (ntohs((__force __be16)maph->pkt_len) == 0)
>  		return NULL;
>  
>  	skbn = alloc_skb(packet_len + RMNET_MAP_DEAGGR_SPACING, GFP_ATOMIC);

Ummm, if you change pkt_len to be a proper __be16, then you don't need these
casts when passing it to ntohs().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ