perfquery.c: Fix smp_query_via return value checks
PATCH 1/1 perfquery.c: Fix smp_query_via return value checks
smp_query_via returns pointer so < 0 comparison is wrong:src/perfquery.c: In function ?is_rsfec_mode_active?:src/perfquery.c:481: warning: ordered comparison of pointer with integer zero src/perfquery.c: In function ?main?:src/perfquery.c:919: warning: ordered comparison of pointer with integer zero src/perfquery.c:928: warning: ordered comparison of pointer with integer zero
---
Fix for OFA Bugzilla #2572
src/perfquery.c +6 -6
@@ -477,8 +477,8 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,return 0 ; } -if (smp_query_via (data, portid,IB_ATTR_PORT_INFO_EXT , port,0 , - srcport) <0 ) +if (!smp_query_via (data, portid,IB_ATTR_PORT_INFO_EXT , port,0 , + srcport))IBEXIT ("smp query portinfo extended failed" );mad_decode_field (data,IB_PORT_EXT_CAPMASK_F , &pie_capmask);
@@ -915,8 +915,8 @@ int main(int argc, char **argv)if (all_ports_loop || (loop_ports && (all_ports || port ==ALL_PORTS ))) { -if (smp_query_via (data, &portid,IB_ATTR_NODE_INFO ,0 ,0 , - srcport) <0 ) +if (!smp_query_via (data, &portid,IB_ATTR_NODE_INFO ,0 ,0 , + srcport))IBEXIT ("smp query nodeinfo failed" ); node_type =mad_get_field (data,0 ,IB_NODE_TYPE_F );mad_decode_field (data,IB_NODE_NPORTS_F , &num_ports);
@@ -924,8 +924,8 @@ int main(int argc, char **argv)IBEXIT ("smp query nodeinfo: num ports invalid" );if (node_type ==IB_NODE_SWITCH ) { -if (smp_query_via (data, &portid,IB_ATTR_SWITCH_INFO , -0 ,0 , srcport) <0 ) +if (!smp_query_via (data, &portid,IB_ATTR_SWITCH_INFO , +0 ,0 , srcport))IBEXIT ("smp query nodeinfo failed" ); enhancedport0 =mad_get_field (data,0 ,IB_SW_ENHANCED_PORT0_F );
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 561BA7E7.4050401-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Quoted 10 lines · Hal Rosenstock
smp_query_viareturns pointer so < 0 comparison is wrong:src/perfquery.c: In function ?is_rsfec_mode_active?:src/perfquery.c:481: warning: ordered comparison of pointer with integer zerosrc/perfquery.c: In function ?main?:src/perfquery.c:919: warning: ordered comparison of pointer with integer zerosrc/perfquery.c:928: warning: ordered comparison of pointer with integer zeroReported-by David Binderman <[email protected]>
There is also a call in ibdiag_common.c which is wrong:
src/ibdiag_common.c +0 -0
@@ -507,7 +507,7 @@ int is_port_info_extended_supported(ib_portid_t * dest, int
port,
uint32_t cap_mask;
uint16_t cap_mask2;- if (smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport) < 0)
+ if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport))
IBEXIT("port info query failed");
mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask);I went ahead and added this chunk to this patch and accepted.
Thanks,
Ira
Quoted 41 lines
---
Fix for OFA Bugzilla #2572src/perfquery.c +6
-7@@ -477,8 +477,8 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,return 0 ; } -if (smp_query_via (data, portid,IB_ATTR_PORT_INFO_EXT , port,0 , - srcport) <0 ) +if (!smp_query_via (data, portid,IB_ATTR_PORT_INFO_EXT , port,0 , + srcport))IBEXIT ("smp query portinfo extended failed" );mad_decode_field (data,IB_PORT_EXT_CAPMASK_F , &pie_capmask);@@ -915,8 +915,8 @@ int main(int argc, char **argv)if (all_ports_loop || (loop_ports && (all_ports || port ==ALL_PORTS ))) { -if (smp_query_via (data, &portid,IB_ATTR_NODE_INFO ,0 ,0 , - srcport) <0 ) +if (!smp_query_via (data, &portid,IB_ATTR_NODE_INFO ,0 ,0 , + srcport))IBEXIT ("smp query nodeinfo failed" ); node_type =mad_get_field (data,0 ,IB_NODE_TYPE_F );mad_decode_field (data,IB_NODE_NPORTS_F , &num_ports);@@ -924,8 +924,8 @@ int main(int argc, char **argv)IBEXIT ("smp query nodeinfo: num ports invalid" );if (node_type ==IB_NODE_SWITCH ) { -if (smp_query_via (data, &portid,IB_ATTR_SWITCH_INFO , -0 ,0 , srcport) <0 ) +if (!smp_query_via (data, &portid,IB_ATTR_SWITCH_INFO , +0 ,0 , srcport))IBEXIT ("smp query nodeinfo failed" ); enhancedport0 =mad_get_field (data,0 ,IB_SW_ENHANCED_PORT0_F ); --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html