[7/8] net: qualcomm: rmnet: mark endianness of struct rmnet_map_dl_csum_trailer fields

Message ID 20190520135354.18628-8-elder@linaro.org
State New
Headers show
Series
  • net: introduce "include/linux/if_rmnet.h"
Related show

Commit Message

Alex Elder May 20, 2019, 1:53 p.m.
Two 16-bit fields (csum_start_offset and csum_length) in the
rmnet_map_dl_csum_trailer structure are currently defined to have
type u16.  But they are in fact big endian values, so should be
properly represented as __be16 values.

No existing code actually references these fields (they're ignored by
rmnet_map_ipv4_dl_csum_trailer() and rmnet_map_ipv6_dl_csum_trailer()).
Changing their type therefore causes no harm, so just fix them.

Signed-off-by: Alex Elder <elder@linaro.org>

---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Bjorn Andersson May 20, 2019, 5:17 p.m. | #1
On Mon 20 May 06:53 PDT 2019, Alex Elder wrote:

> Two 16-bit fields (csum_start_offset and csum_length) in the

> rmnet_map_dl_csum_trailer structure are currently defined to have

> type u16.  But they are in fact big endian values, so should be

> properly represented as __be16 values.

> 

> No existing code actually references these fields (they're ignored by

> rmnet_map_ipv4_dl_csum_trailer() and rmnet_map_ipv6_dl_csum_trailer()).

> Changing their type therefore causes no harm, so just fix them.

> 

> Signed-off-by: Alex Elder <elder@linaro.org>


Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>


> ---

>  drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h

> index fb1cdb4ec41f..775b98d34e94 100644

> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h

> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h

> @@ -52,8 +52,8 @@ struct rmnet_map_header {

>  struct rmnet_map_dl_csum_trailer {

>  	u8  reserved1;

>  	u8  flags;		/* RMNET_MAP_DL_* */

> -	u16 csum_start_offset;

> -	u16 csum_length;

> +	__be16 csum_start_offset;

> +	__be16 csum_length;

>  	__be16 csum_value;

>  } __aligned(1);

>  

> -- 

> 2.20.1

>

Patch

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
index fb1cdb4ec41f..775b98d34e94 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
@@ -52,8 +52,8 @@  struct rmnet_map_header {
 struct rmnet_map_dl_csum_trailer {
 	u8  reserved1;
 	u8  flags;		/* RMNET_MAP_DL_* */
-	u16 csum_start_offset;
-	u16 csum_length;
+	__be16 csum_start_offset;
+	__be16 csum_length;
 	__be16 csum_value;
 } __aligned(1);