Skip to content

Avoid warnings about using unitialized dest_dir

Mauro Carvalho Chehab linux-media lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3dvb_net: prepare to split a very complex functiondrivers/media/dvb-core/dvb_net.c+245 -2200 replies
2/3dvb-net: split the logic at dvb_net_ule() into other functionsdrivers/media/dvb-core/dvb_net.c+467 -3610 replies
3/3dvb_net: simplify the logic that fills the ethernet addressdrivers/media/dvb-core/dvb_net.c+4 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Avoid warnings about using unitialized dest_dir

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(-)
Signature · 1 line
2.7.4