mad_rpc(): Fail with EINVAL if max_retries <= 0
PATCH 1/1 mad_rpc(): Fail with EINVAL if max_retries <= 0
Set errno to EINVAL instead of an undefined value if max_retries <= 0. This patch avoids that the following compiler warning is triggered:
src/rpc.c:187:8: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by Bart Van Assche <[email protected]>
--- src/rpc.c | 7 +++++++ 1 file changed, 7 insertions(+)
src/rpc.c +7 -0
@@ -144,6 +144,13 @@ _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len, save_mad =0 ; } +if (max_retries <=0 ) { + errno =EINVAL ; + *p_error =EINVAL ; +ERRS ("max_retries %d <= 0" , max_retries); +return -1 ; + } + trid = (uint32_t )mad_get_field64 (umad_get_mad (sndbuf),0 ,IB_MAD_TRID_F );
Signature · 6 lines
1.7.10.4 -- 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
Ira Weiny
AppliedQuoted 6 lines · On Sun, 18 Aug 2013 10:37:11 +0200 Bart Van Assche…
Set errno to EINVAL instead of an undefined value if
max_retries<= 0. This patch avoids that the following compiler warning is triggered:
src/rpc.c:187:8: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized]Signed-off-by Bart Van Assche <[email protected]>
Thanks Applied,
Ira
Quoted 25 lines
--- src/rpc.c | 7 +++++++ 1 file changed, 7 insertions(+)src/rpc.c +7
-0@@ -144,6 +144,13 @@ _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len, save_mad =0 ; } +if (max_retries <=0 ) { + errno =EINVAL ; + *p_error =EINVAL ; +ERRS ("max_retries %d <= 0" , max_retries); +return -1 ; + } + trid = (uint32_t )mad_get_field64 (umad_get_mad (sndbuf),0 ,IB_MAD_TRID_F );Signature · 1 line
1.7.10.4
Signature · 5 lines
Ira Weiny <[email protected]> -- 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