From patchwork Thu Oct 27 13:57:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9399455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9CF2060233 for ; Thu, 27 Oct 2016 14:10:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A27722A314 for ; Thu, 27 Oct 2016 14:10:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92E232A302; Thu, 27 Oct 2016 14:10:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A44A22A312 for ; Thu, 27 Oct 2016 14:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965831AbcJ0OI7 (ORCPT ); Thu, 27 Oct 2016 10:08:59 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:58521 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965819AbcJ0OI4 (ORCPT ); Thu, 27 Oct 2016 10:08:56 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0Lwqoy-1cxPO3434K-016Otz; Thu, 27 Oct 2016 16:08:40 +0200 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , Hans Verkuil , Jarod Wilson , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] dvb: avoid warning in dvb_net Date: Thu, 27 Oct 2016 15:57:41 +0200 Message-Id: <20161027140835.2345937-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:+Gwk73k5SueLWDnq/UkCvpYywo2O3kTAxH1dURY2xyyNlEBcqfx cZu8janPmPsFmcBc5qx2WrdEjL4GRPbMvwxF84atPdx8UYtWe0GvRw1Fu2HlqMfNCGGIS19 m8GEajBCSYCY2JE3wZJt7vDw52gx9QoFDRv38nYARON7CdzAOPeCIPMJWuce9hdVFXd1BEF zuiQdXQ118QZWz4xzGkbQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:MmWzERpx/oI=:yq+SAVap2M43jSoFhIj4JG Iut7LJ8yoaAj2r2DDlhayLa7lqHbIoOGkL0FStkESoiA3rNqbKsUs+sPxtDIt2u3OyAsX10Mk y7DTF8fn1zZcZge/dVCtSIHXn6USb8j98485Q/J62iI5clOxsf5E2EV3GI3NkdcyGfNX0Xi+h IB30bR8jP68GKrjgwGSYnCESISzHq2snfn4Aj3YHck9/U1YfM5zhpBX6AAoWsEfzzeXqdy4r/ x8mw2Hpt8sgJpWq1GJa2FLwJTOyxxNUV0PbTQAH3wCVDWaojVdwFQHFX3qmvwCadjbp33trHR LxIQm8Duf7UrVoDRnXV98vVws1oKVBiqKETBw5J/esPYa44m1MdEUIPoU9k2j638RBgcbwZki c+/n6f6dHtiA5L/jB3hQDBQMG4rPcM5xSxAjGEYWZHfqSAgISAG5eBjKFkXDqRhJo8zdq7W5d 5+NZ7a8DXi39pz9UoBwWpve3ZJ1J1Quug0NYbdagzMEMyPb7efZOZsWjnAU7svuPPDRIml7M4 PzZf1EX1pOuDEN2JA5QUnljmuC2Kz03L2qQwuuwwHk3tFfb47qrWN+bAfc++HblV0IFrhjwgv Uf4QmvYf4JJBctr5VKnT49E6XAa1lXzgOSdf6TK6BtZlGZV86zVcYHOfPSulJOSW2iH0ppiHM 0ChRA0Mwh5kgrUih4z/rh3EunhrE1195z5N3cqENUz78ziZxZdlu+/LQCIYj6ooE6kzl4tvNb tTDW+e5vXsC1+b+U Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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:77:14: error: ‘dest_addr’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/media/dvb-core/dvb_net.c:633:8: note: ‘dest_addr’ was declared here 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 --- drivers/media/dvb-core/dvb_net.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index 088914c4623f..f1b416de9dab 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -688,6 +688,9 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) ETH_ALEN); skb_pull(priv->ule_skb, ETH_ALEN); } + } else { + /* othersie use zero destination address */ + eth_zero_addr(dest_addr); } /* Handle ULE Extension Headers. */ @@ -715,13 +718,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) if (!priv->ule_bridged) { skb_push(priv->ule_skb, ETH_HLEN); ethh = (struct ethhdr *)priv->ule_skb->data; - if (!priv->ule_dbit) { - /* dest_addr buffer is only valid if priv->ule_dbit == 0 */ - memcpy(ethh->h_dest, dest_addr, ETH_ALEN); - eth_zero_addr(ethh->h_source); - } - else /* zeroize source and dest */ - memset( ethh, 0, ETH_ALEN*2 ); + memcpy(ethh->h_dest, dest_addr, ETH_ALEN); + eth_zero_addr(ethh->h_source); ethh->h_proto = htons(priv->ule_sndu_type); }