Commit 4dd19196 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mauro Carvalho Chehab

[media] dvb: avoid warning in dvb_net

With gcc-5 or higher on x86, we can get a bogus warning in the
dvb-net code:

drivers/media/dvb-core/dvb_net.c: In function 'dvb_net_ule':
arch/x86/include/asm/string_32.h:78:22: error: '*((void *)&dest_addr+4)' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The problem here is that gcc doesn't track all of the conditions
to prove it can't end up copying uninitialized data.
This changes the logic around so we zero out the destination
address earlier when we determine that it is not set here.
This allows the compiler to figure it out.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 79d6205a
...@@ -719,6 +719,9 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h, ...@@ -719,6 +719,9 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
skb_copy_from_linear_data(h->priv->ule_skb, dest_addr, skb_copy_from_linear_data(h->priv->ule_skb, dest_addr,
ETH_ALEN); ETH_ALEN);
skb_pull(h->priv->ule_skb, ETH_ALEN); skb_pull(h->priv->ule_skb, ETH_ALEN);
} else {
/* dest_addr buffer is only valid if h->priv->ule_dbit == 0 */
eth_zero_addr(dest_addr);
} }
/* Handle ULE Extension Headers. */ /* Handle ULE Extension Headers. */
...@@ -750,16 +753,8 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h, ...@@ -750,16 +753,8 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
if (!h->priv->ule_bridged) { if (!h->priv->ule_bridged) {
skb_push(h->priv->ule_skb, ETH_HLEN); skb_push(h->priv->ule_skb, ETH_HLEN);
h->ethh = (struct ethhdr *)h->priv->ule_skb->data; h->ethh = (struct ethhdr *)h->priv->ule_skb->data;
if (!h->priv->ule_dbit) { memcpy(h->ethh->h_dest, dest_addr, ETH_ALEN);
/* eth_zero_addr(h->ethh->h_source);
* dest_addr buffer is only valid if
* h->priv->ule_dbit == 0
*/
memcpy(h->ethh->h_dest, dest_addr, ETH_ALEN);
eth_zero_addr(h->ethh->h_source);
} else /* zeroize source and dest */
memset(h->ethh, 0, ETH_ALEN * 2);
h->ethh->h_proto = htons(h->priv->ule_sndu_type); h->ethh->h_proto = htons(h->priv->ule_sndu_type);
} }
/* else: skb is in correct state; nothing to do. */ /* else: skb is in correct state; nothing to do. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment