diff mbox

[2/6] Cast poniter type

Message ID 20180720025038.9365-3-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Honggang LI July 20, 2018, 2:50 a.m. UTC
From: Honggang Li <honli@redhat.com>

make[2]: Entering directory '/home/honli/upstream-repos/opensm/libvendor'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include  -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo './'`osm_vendor_ibumad.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c osm_vendor_ibumad.c  -fPIC -DPIC -o .libs/libosmvendor_la-osm_vendor_ibumad.o
osm_vendor_ibumad.c: In function ‘osm_vendor_open_port’:
osm_vendor_ibumad.c:745:56: error: passing argument 2 of ‘umad_get_ca_portguids’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
                                                        ^~~~~~~~~
In file included from ../include/vendor/osm_vendor_ibumad.h:44,
                 from ../include/vendor/osm_vendor.h:65,
                 from ../include/opensm/osm_madw.h:52,
                 from osm_vendor_ibumad.c:66:
/usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
 int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
                                                ~~~~~~~~^~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Honggang Li <honli@redhat.com>
---
 libvendor/osm_vendor_ibumad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hal Rosenstock July 26, 2018, 10:56 a.m. UTC | #1
On 7/19/2018 10:50 PM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> make[2]: Entering directory '/home/honli/upstream-repos/opensm/libvendor'
> /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include  -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo './'`osm_vendor_ibumad.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c osm_vendor_ibumad.c  -fPIC -DPIC -o .libs/libosmvendor_la-osm_vendor_ibumad.o
> osm_vendor_ibumad.c: In function ‘osm_vendor_open_port’:
> osm_vendor_ibumad.c:745:56: error: passing argument 2 of ‘umad_get_ca_portguids’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>    if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
>                                                         ^~~~~~~~~
> In file included from ../include/vendor/osm_vendor_ibumad.h:44,
>                  from ../include/vendor/osm_vendor.h:65,
>                  from ../include/opensm/osm_madw.h:52,
>                  from osm_vendor_ibumad.c:66:
> /usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
>  int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
>                                                 ~~~~~~~~^~~~~~~~~
> cc1: all warnings being treated as errors

When libibumad was moved into rdma-core, the type of the portguids
parameter for the umad_get_ca_portguids API was changed from uint64_t to
__be64 and this was thought to be safe because it was thought that these
types were the same but that appears not to be the case here ;-(

On what CPU arch was this compiled ?

> Signed-off-by: Honggang Li <honli@redhat.com>
> ---
>  libvendor/osm_vendor_ibumad.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c
> index 92696d3e6086..6a3665be81f6 100644
> --- a/libvendor/osm_vendor_ibumad.c
> +++ b/libvendor/osm_vendor_ibumad.c
> @@ -742,7 +742,7 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
>  	}
>  
>  	for (ca = 0; ca < p_vend->ca_count; ca++) {
> -		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
> +		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], (__be64 *)portguids,

The above is fine for libibumads (umad.h) incorporated into rdma-core
but won't work with (older) libibumads (umad.h) prior to it's
incorporation into rdma-core. This seems to need some conditionalization
but I'm not sure what it would/could be conditionalized on as yet.

-- Hal

>  					       OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) {
>  #ifdef __WIN__
>  			OSM_LOG(p_vend->p_log, OSM_LOG_VERBOSE,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Honggang LI July 26, 2018, 11:25 a.m. UTC | #2
On Thu, Jul 26, 2018 at 06:56:14AM -0400, Hal Rosenstock wrote:
> On 7/19/2018 10:50 PM, Honggang LI wrote:
> > From: Honggang Li <honli@redhat.com>
> > 
> > make[2]: Entering directory '/home/honli/upstream-repos/opensm/libvendor'
> > /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include  -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo './'`osm_vendor_ibumad.c
> > libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c osm_vendor_ibumad.c  -fPIC -DPIC -o .libs/libosmvendor_la-osm_vendor_ibumad.o
> > osm_vendor_ibumad.c: In function ‘osm_vendor_open_port’:
> > osm_vendor_ibumad.c:745:56: error: passing argument 2 of ‘umad_get_ca_portguids’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
> >                                                         ^~~~~~~~~
> > In file included from ../include/vendor/osm_vendor_ibumad.h:44,
> >                  from ../include/vendor/osm_vendor.h:65,
> >                  from ../include/opensm/osm_madw.h:52,
> >                  from osm_vendor_ibumad.c:66:
> > /usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
> >  int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
> >                                                 ~~~~~~~~^~~~~~~~~
> > cc1: all warnings being treated as errors
> 
> When libibumad was moved into rdma-core, the type of the portguids
> parameter for the umad_get_ca_portguids API was changed from uint64_t to
> __be64 and this was thought to be safe because it was thought that these
> types were the same but that appears not to be the case here ;-(
> 
> On what CPU arch was this compiled ?

My machine is running fedora-28 x86-64 distro.

]$ rpm -q rdma-core kernel
rdma-core-16.2-3.fc28.x86_64
kernel-4.18.0-0.rc4.git1.1.fc29.x86_64

[ ~]$ lscpu 
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               60
Model name:          Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
Stepping:            3
CPU MHz:             2793.767
CPU max MHz:         3800.0000
CPU min MHz:         800.0000
BogoMIPS:            5587.30
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            6144K
NUMA node0 CPU(s):   0-7
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts


> 
> > Signed-off-by: Honggang Li <honli@redhat.com>
> > ---
> >  libvendor/osm_vendor_ibumad.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c
> > index 92696d3e6086..6a3665be81f6 100644
> > --- a/libvendor/osm_vendor_ibumad.c
> > +++ b/libvendor/osm_vendor_ibumad.c
> > @@ -742,7 +742,7 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
> >  	}
> >  
> >  	for (ca = 0; ca < p_vend->ca_count; ca++) {
> > -		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
> > +		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], (__be64 *)portguids,
> 
> The above is fine for libibumads (umad.h) incorporated into rdma-core
> but won't work with (older) libibumads (umad.h) prior to it's
> incorporation into rdma-core. This seems to need some conditionalization
> but I'm not sure what it would/could be conditionalized on as yet.
> 
> -- Hal
> 
> >  					       OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) {
> >  #ifdef __WIN__
> >  			OSM_LOG(p_vend->p_log, OSM_LOG_VERBOSE,
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe July 26, 2018, 4:12 p.m. UTC | #3
On Thu, Jul 26, 2018 at 06:56:14AM -0400, Hal Rosenstock wrote:
> On 7/19/2018 10:50 PM, Honggang LI wrote:
> > From: Honggang Li <honli@redhat.com>
> > 
> > make[2]: Entering directory '/home/honli/upstream-repos/opensm/libvendor'
> > /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include  -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo './'`osm_vendor_ibumad.c
> > libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c osm_vendor_ibumad.c  -fPIC -DPIC -o .libs/libosmvendor_la-osm_vendor_ibumad.o
> > osm_vendor_ibumad.c: In function ‘osm_vendor_open_port’:
> > osm_vendor_ibumad.c:745:56: error: passing argument 2 of ‘umad_get_ca_portguids’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
> >                                                         ^~~~~~~~~
> > In file included from ../include/vendor/osm_vendor_ibumad.h:44,
> >                  from ../include/vendor/osm_vendor.h:65,
> >                  from ../include/opensm/osm_madw.h:52,
> >                  from osm_vendor_ibumad.c:66:
> > /usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
> >  int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
> >                                                 ~~~~~~~~^~~~~~~~~
> > cc1: all warnings being treated as errors
> 
> When libibumad was moved into rdma-core, the type of the portguids
> parameter for the umad_get_ca_portguids API was changed from uint64_t to
> __be64 and this was thought to be safe because it was thought that these
> types were the same but that appears not to be the case here ;-(

They are the same, this is just a somewhat expected warning.

If you insist on compiling with -Werror then these things have to be
fixed, otherwise the warning is harmless.

The proper fix is likely to change ib_net64_t to __be64.

> The above is fine for libibumads (umad.h) incorporated into rdma-core
> but won't work with (older) libibumads (umad.h) prior to it's
> incorporation into rdma-core. This seems to need some conditionalization
> but I'm not sure what it would/could be conditionalized on as yet.

Well, you get a harmless warning. Ignore the warning if someone mixes
old with new.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Honggang LI July 27, 2018, 8:57 a.m. UTC | #4
On Thu, Jul 26, 2018 at 10:12:42AM -0600, Jason Gunthorpe wrote:
> > >                  from osm_vendor_ibumad.c:66:
> > > /usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
> > >  int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
> > >                                                 ~~~~~~~~^~~~~~~~~
> > > cc1: all warnings being treated as errors
> > 
> > When libibumad was moved into rdma-core, the type of the portguids
> > parameter for the umad_get_ca_portguids API was changed from uint64_t to
> > __be64 and this was thought to be safe because it was thought that these
> > types were the same but that appears not to be the case here ;-(
> 
> They are the same, this is just a somewhat expected warning.
> 
> If you insist on compiling with -Werror then these things have to be
> fixed, otherwise the warning is harmless.
> 
> The proper fix is likely to change ib_net64_t to __be64.

+1, I suggest to replace 'ib_net64_t' with '__be64'.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hal Rosenstock July 27, 2018, 11:57 a.m. UTC | #5
On 7/26/2018 12:12 PM, Jason Gunthorpe wrote:
> On Thu, Jul 26, 2018 at 06:56:14AM -0400, Hal Rosenstock wrote:
>> On 7/19/2018 10:50 PM, Honggang LI wrote:
>>> From: Honggang Li <honli@redhat.com>
>>>
>>> make[2]: Entering directory '/home/honli/upstream-repos/opensm/libvendor'
>>> /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm  -I./../include -I./../../libibumad/include -I/usr/local/include  -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c -o libosmvendor_la-osm_vendor_ibumad.lo `test -f 'osm_vendor_ibumad.c' || echo './'`osm_vendor_ibumad.c
>>> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -g -O2 -MT libosmvendor_la-osm_vendor_ibumad.lo -MD -MP -MF .deps/libosmvendor_la-osm_vendor_ibumad.Tpo -c osm_vendor_ibumad.c  -fPIC -DPIC -o .libs/libosmvendor_la-osm_vendor_ibumad.o
>>> osm_vendor_ibumad.c: In function ‘osm_vendor_open_port’:
>>> osm_vendor_ibumad.c:745:56: error: passing argument 2 of ‘umad_get_ca_portguids’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>>>    if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
>>>                                                         ^~~~~~~~~
>>> In file included from ../include/vendor/osm_vendor_ibumad.h:44,
>>>                  from ../include/vendor/osm_vendor.h:65,
>>>                  from ../include/opensm/osm_madw.h:52,
>>>                  from osm_vendor_ibumad.c:66:
>>> /usr/include/infiniband/umad.h:178:56: note: expected ‘__be64 *’ {aka ‘long long unsigned int *’} but argument is of type ‘ib_net64_t *’ {aka ‘long unsigned int *’}
>>>  int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max);
>>>                                                 ~~~~~~~~^~~~~~~~~
>>> cc1: all warnings being treated as errors
>>
>> When libibumad was moved into rdma-core, the type of the portguids
>> parameter for the umad_get_ca_portguids API was changed from uint64_t to
>> __be64 and this was thought to be safe because it was thought that these
>> types were the same but that appears not to be the case here ;-(
> 
> They are the same, this is just a somewhat expected warning.
> 
> If you insist on compiling with -Werror then these things have to be
> fixed, otherwise the warning is harmless.
> 
> The proper fix is likely to change ib_net64_t to __be64.

That would move the same issue to when compiling OpenSM with -Werror
with older libibumads (umad.h).

>> The above is fine for libibumads (umad.h) incorporated into rdma-core
>> but won't work with (older) libibumads (umad.h) prior to it's
>> incorporation into rdma-core. This seems to need some conditionalization
>> but I'm not sure what it would/could be conditionalized on as yet.
> 
> Well, you get a harmless warning. Ignore the warning if someone mixes
> old with new.

I think that just ignoring the harmless warning is the easiest way to go.

-- Hal

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

Patch

diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c
index 92696d3e6086..6a3665be81f6 100644
--- a/libvendor/osm_vendor_ibumad.c
+++ b/libvendor/osm_vendor_ibumad.c
@@ -742,7 +742,7 @@  osm_vendor_open_port(IN osm_vendor_t * const p_vend,
 	}
 
 	for (ca = 0; ca < p_vend->ca_count; ca++) {
-		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,
+		if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], (__be64 *)portguids,
 					       OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) {
 #ifdef __WIN__
 			OSM_LOG(p_vend->p_log, OSM_LOG_VERBOSE,