From 95f21d59b78c66094497e9ba64ba6d2a7a14afcb Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Wed, 13 Feb 2019 13:37:25 -0800 Subject: [PATCH] net: lwm2m: remove checks for long int > MAX_INT Per Coverity report, the evaluation of long int v > MAX_INT is always false and considered a CONSTANT_EXPRESS_RESULT issue. Removed these checks from: atof32() lwm2m_write_attr_handler() Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/12317 Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/12320 Signed-off-by: Michael Scott --- subsys/net/lib/lwm2m/lwm2m_engine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index daff9f22b7c..e442683dc8b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -848,7 +848,7 @@ static int atof32(const char *input, float32_value_t *out) errno = 0; val = strtol(buf, &end, 10); - if (errno || *end || val > INT_MAX || val < INT_MIN) { + if (errno || *end || val < INT_MIN) { return -EINVAL; } @@ -2394,7 +2394,7 @@ static int lwm2m_write_attr_handler(struct lwm2m_engine_obj *obj, */ errno = 0; v = strtol(opt_buf, &end, 10); - if (errno || *end || v > INT_MAX || v < 0) { + if (errno || *end || v < 0) { ret = -EINVAL; }