diff mbox series

[ibsim,14/23] sim_mad.c: Fix NO_EFFECT issue for do_linearforwtbl

Message ID 20190102131318.5765-14-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series [ibsim,01/23] move sim_cmd_file into ibsim/sim_cmd.c | expand

Commit Message

Honggang LI Jan. 2, 2019, 1:13 p.m. UTC
Issue was detected by Coverity.

This less-than-zero comparison of an unsigned value is never true. "mod
< 0U".

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

Comments

Hal Rosenstock Jan. 4, 2019, 12:24 p.m. UTC | #1
On 1/2/2019 8:13 AM, Honggang Li wrote:
> Issue was detected by Coverity.
> 
> This less-than-zero comparison of an unsigned value is never true. "mod
> < 0U".
> 
> Signed-off-by: Honggang Li <honli@redhat.com>

Thanks. Applied.

-- Hal
diff mbox series

Patch

diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index a89e2d62afd8..b6e24881fb9e 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -711,7 +711,7 @@  static int do_linearforwtbl(Port * port, unsigned op, uint32_t mod,
 	if (!sw)		// not a Switch?
 		return ERR_ATTR_UNSUPPORTED;
 
-	if (mod < 0 || mod > 767)
+	if (mod > 767)
 		return ERR_BAD_PARAM;
 
 	if (op == IB_MAD_METHOD_SET)