net: explicit cast of multicast bit clearing
authorAndy Green <andy@warmcat.com>
Thu, 17 May 2018 13:49:47 +0000 (21:49 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 20 May 2018 22:21:24 +0000 (00:21 +0200)
GCC 8.1 warned:

rte_ether.h:213:13:
warning: conversion from 'int' to 'uint8_t'
{aka 'unsigned char'} may change value [-Wconversion]
  addr[0] &= ~ETHER_GROUP_ADDR;

Fixes: 7ef007291004 ("ethdev: random MAC address")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_net/rte_ether.h

index 27c9195..bee2b34 100644 (file)
@@ -210,7 +210,7 @@ static inline void eth_random_addr(uint8_t *addr)
        uint8_t *p = (uint8_t *)&rand;
 
        rte_memcpy(addr, p, ETHER_ADDR_LEN);
-       addr[0] &= ~ETHER_GROUP_ADDR;       /* clear multicast bit */
+       addr[0] &= (uint8_t)~ETHER_GROUP_ADDR;       /* clear multicast bit */
        addr[0] |= ETHER_LOCAL_ADMIN_ADDR;  /* set local assignment bit */
 }