linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Arnd Bergmann <arnd@arndb.de>, Jarod Wilson <jarod@redhat.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [PATCH 0/3] Avoid warnings about using unitialized dest_dir
Date: Sat, 19 Nov 2016 12:56:57 -0200	[thread overview]
Message-ID: <cover.1479567006.git.mchehab@s-opensource.com> (raw)
In-Reply-To: <20161027150848.3623829-1-arnd@arndb.de>

As Arnd reported:

	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

Inspecting the code is really hard, as the function Arnd patched is really
complex.

IMHO, the best is to first simplify the logic, by breaking parts of it into
sub-routines, and then apply a proper fix.

This patch series does that.

Arnd,

After splitting the function, I think that the GCC 5 warning is not bogus,
as this code:
		skb_copy_from_linear_data(h->priv->ule_skb, dest_addr,
					  ETH_ALEN);

is called before initializing dest_dir, but, even if I'm wrong, it is not a bad
idea to zero the dest_addr before handing the logic.

PS.: I took a lot of care to avoid breaking something on this series, as I don't
have any means here to test DVB net.  So, I'd appreciate if you could take
a look and see if everything looks fine.

Thanks!
Mauro


Mauro Carvalho Chehab (3):
  [media] dvb_net: prepare to split a very complex function
  [media] dvb-net: split the logic at dvb_net_ule() into other functions
  [media] dvb_net: simplify the logic that fills the ethernet address

 drivers/media/dvb-core/dvb_net.c | 927 ++++++++++++++++++++++-----------------
 1 file changed, 526 insertions(+), 401 deletions(-)

-- 
2.7.4



  reply	other threads:[~2016-11-19 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 15:08 [PATCH v2] [media] dvb: avoid warning in dvb_net Arnd Bergmann
2016-11-19 14:56 ` Mauro Carvalho Chehab [this message]
2016-11-19 14:56   ` [PATCH 1/3] [media] dvb_net: prepare to split a very complex function Mauro Carvalho Chehab
2016-11-19 14:56   ` [PATCH 2/3] [media] dvb-net: split the logic at dvb_net_ule() into other functions Mauro Carvalho Chehab
2016-11-19 14:57   ` [PATCH 3/3] [media] dvb_net: simplify the logic that fills the ethernet address Mauro Carvalho Chehab
2016-11-21 16:35   ` [PATCH 0/3] Avoid warnings about using unitialized dest_dir Arnd Bergmann
2016-11-25  8:50     ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1479567006.git.mchehab@s-opensource.com \
    --to=mchehab@s-opensource.com \
    --cc=arnd@arndb.de \
    --cc=hans.verkuil@cisco.com \
    --cc=jarod@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).