linux_dsm_epyc7002/drivers/infiniband/hw/i40iw
Arnd Bergmann 2fe7857176 i40iw: avoid potential uninitialized variable use
gcc finds that the i40iw_make_cm_node() function in the recently added
i40iw driver uses an uninitilized variable as an index into an array
if CONFIG_IPV6 is disabled and the driver uses IPv6 mode:

drivers/infiniband/hw/i40iw/i40iw_cm.c: In function 'i40iw_make_cm_node':
drivers/infiniband/hw/i40iw/i40iw_cm.c:2206:52: error: 'arpindex' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  ether_addr_copy(cm_node->rem_mac, iwdev->arp_table[arpindex].mac_addr);

As far as I can tell, this code path can not be used because the ipv4
variable is always set with CONFIG_IPV6 is disabled, but it's better
to be sure and prevent the undefined behavior, as well as shut up
that warning in a proper way.

This adds an 'else' clause for the case we get the warning about,
causing the function to return an error in a controlled way.
To avoid adding extra mess with combined io()/#ifdef clauses,
I'm also converting the existing #ifdef into a more readable
if(IS_ENABLED()) check.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f27b4746f3 ("i40iw: add connection management code")
Acked-by: Mustafa Ismail <Mustafa.ismail@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-06 10:37:16 -04:00
..
i40iw_cm.c i40iw: avoid potential uninitialized variable use 2016-04-06 10:37:16 -04:00
i40iw_cm.h i40iw: add connection management code 2016-02-29 17:10:53 -05:00
i40iw_ctrl.c i40iw: add file to handle cqp calls 2016-03-16 13:50:52 -04:00
i40iw_d.h i40iw: add hardware related header files 2016-03-16 13:50:52 -04:00
i40iw_hmc.c i40iw: add hmc resource files 2016-02-29 17:10:53 -05:00
i40iw_hmc.h i40iw: add hmc resource files 2016-02-29 17:10:53 -05:00
i40iw_hw.c i40iw: use shared code for port mapper 2016-03-16 13:50:52 -04:00
i40iw_main.c i40iw: use shared code for port mapper 2016-03-16 13:50:52 -04:00
i40iw_osdep.h i40iw: Replace the obsolete crypto hash interface with shash 2016-03-21 16:02:24 -04:00
i40iw_p.h i40iw: add hardware related header files 2016-03-16 13:50:52 -04:00
i40iw_pble.c i40iw: add pble resource files 2016-02-29 17:10:53 -05:00
i40iw_pble.h i40iw: add pble resource files 2016-02-29 17:10:53 -05:00
i40iw_puda.c i40iw: Replace the obsolete crypto hash interface with shash 2016-03-21 16:02:24 -04:00
i40iw_puda.h i40iw: Replace the obsolete crypto hash interface with shash 2016-03-21 16:02:24 -04:00
i40iw_register.h i40iw: add X722 register file 2016-03-16 13:50:53 -04:00
i40iw_status.h
i40iw_type.h i40iw: add hardware related header files 2016-03-16 13:50:52 -04:00
i40iw_ucontext.h i40iw: add files for iwarp interface 2016-02-29 17:10:53 -05:00
i40iw_uk.c i40iw: user kernel shared files 2016-03-16 13:50:53 -04:00
i40iw_user.h i40iw: user kernel shared files 2016-03-16 13:50:53 -04:00
i40iw_utils.c i40iw: Replace the obsolete crypto hash interface with shash 2016-03-21 16:02:24 -04:00
i40iw_verbs.c i40iw: use shared code for port mapper 2016-03-16 13:50:52 -04:00
i40iw_verbs.h i40iw: add files for iwarp interface 2016-02-29 17:10:53 -05:00
i40iw_vf.c i40iw: virtual channel handling files 2016-03-16 13:50:53 -04:00
i40iw_vf.h i40iw: virtual channel handling files 2016-03-16 13:50:53 -04:00
i40iw_virtchnl.c i40iw: virtual channel handling files 2016-03-16 13:50:53 -04:00
i40iw_virtchnl.h i40iw: virtual channel handling files 2016-03-16 13:50:53 -04:00
i40iw.h i40iw: Replace the obsolete crypto hash interface with shash 2016-03-21 16:02:24 -04:00
Kconfig i40iw: Kconfig and Makefile for iwarp module 2016-03-16 13:50:54 -04:00
Makefile i40iw: Kconfig and Makefile for iwarp module 2016-03-16 13:50:54 -04:00