Re: [PATCH 4/6] Fix maybe uninitialized issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/19/2018 10:50 PM, Honggang LI wrote:
> From: Honggang Li <honli@xxxxxxxxxx>
> 
> make[2]: Entering directory '/home/honli/upstream-repos/opensm/opensm'
> depbase=`echo osm_sa_mcmember_record.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include   -Werror -Wall -Wwrite-strings -g -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -g -O2 -MT osm_sa_mcmember_record.o -MD -MP -MF $depbase.Tpo -c -o osm_sa_mcmember_record.o osm_sa_mcmember_record.c &&\
> mv -f $depbase.Tpo $depbase.Po
> osm_sa_mcmember_record.c: In function ‘osm_mcmr_rcv_process’:
> osm_sa_mcmember_record.c:1579:3: error: ‘port_gid’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> osm_sa_mcmember_record.c:1478:11: note: ‘port_gid’ was declared here
>   ib_gid_t port_gid;
>            ^~~~~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Honggang Li <honli@xxxxxxxxxx>
> ---
>  opensm/osm_sa_mcmember_record.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c
> index dc805bcf64f8..db2188e5de5a 100644
> --- a/opensm/osm_sa_mcmember_record.c
> +++ b/opensm/osm_sa_mcmember_record.c
> @@ -1478,6 +1478,8 @@ static void mcmr_by_comp_mask(osm_sa_t * sa, const ib_member_rec_t * p_rcvd_rec,
>  	ib_gid_t port_gid;
>  	boolean_t proxy_join = FALSE;
>  
> +	memset(&port_gid, 0, sizeof(port_gid));
> +
>  	OSM_LOG_ENTER(sa->p_log);
>  
>  	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
> 

Thanks. Applied.

Note just moved memset down after OSM_LOG call.

-- Hal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux