aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-12-09 06:36:29 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-21 04:33:14 -0500
commit4dd19196c5539c377beaa9850fac30c18318c7a1 (patch)
tree8689a9f13298a3855dae0288b274da828848a42c
parent79d6205a3f741c9fb89cfc47dfa0eddb1526726d (diff)
[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: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/dvb-core/dvb_net.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index bd833b0824c6..eb60cb1442f2 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -719,6 +719,9 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
719 skb_copy_from_linear_data(h->priv->ule_skb, dest_addr, 719 skb_copy_from_linear_data(h->priv->ule_skb, dest_addr,
720 ETH_ALEN); 720 ETH_ALEN);
721 skb_pull(h->priv->ule_skb, ETH_ALEN); 721 skb_pull(h->priv->ule_skb, ETH_ALEN);
722 } else {
723 /* dest_addr buffer is only valid if h->priv->ule_dbit == 0 */
724 eth_zero_addr(dest_addr);
722 } 725 }
723 726
724 /* Handle ULE Extension Headers. */ 727 /* Handle ULE Extension Headers. */
@@ -750,16 +753,8 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
750 if (!h->priv->ule_bridged) { 753 if (!h->priv->ule_bridged) {
751 skb_push(h->priv->ule_skb, ETH_HLEN); 754 skb_push(h->priv->ule_skb, ETH_HLEN);
752 h->ethh = (struct ethhdr *)h->priv->ule_skb->data; 755 h->ethh = (struct ethhdr *)h->priv->ule_skb->data;
753 if (!h->priv->ule_dbit) { 756 memcpy(h->ethh->h_dest, dest_addr, ETH_ALEN);
754 /* 757 eth_zero_addr(h->ethh->h_source);
755 * dest_addr buffer is only valid if
756 * h->priv->ule_dbit == 0
757 */
758 memcpy(h->ethh->h_dest, dest_addr, ETH_ALEN);
759 eth_zero_addr(h->ethh->h_source);
760 } else /* zeroize source and dest */
761 memset(h->ethh, 0, ETH_ALEN * 2);
762
763 h->ethh->h_proto = htons(h->priv->ule_sndu_type); 758 h->ethh->h_proto = htons(h->priv->ule_sndu_type);
764 } 759 }
765 /* else: skb is in correct state; nothing to do. */ 760 /* else: skb is in correct state; nothing to do. */