[dpdk-dev] [PATCH] power: fix argument cannot be negative
Thomas Monjalon
thomas.monjalon at 6wind.com
Mon May 16 14:16:53 CEST 2016
The title do not convey the real issue.
We should be more concerned by an issue of "wrong error message"
rather than an "argument" which "cannot be negative".
2016-04-20 16:39, Daniel Mrzyglod:
> Fix issue reported by Coverity.
> Coverity ID 13269 & 13266:
It is better to put these references below and start with the
explanation of the issue.
> Function strerror(errno) has built strings only for non-negative errno values.
> for negative values of errno it describe error as "Unknown error -errno"
> to be more descriptive i put string "channel not found" taken from header.
>
> The negative argument will be interpreted as a very large unsigned value.
OK.
The next statement is probably a useless copy paste of the coverity report.
> In send_msg: Negative value used as argument to a function expecting
> a positive value (for example, size of buffer or allocation)
Coverity issue: 13266
Coverity issue: 13269
> Fixes: 445c6528b55f ("power: common interface for guest and host")
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod at intel.com>
[...]
> RTE_LOG(ERR, GUEST_CHANNEL, "Error on channel '%s' communications "
> - "test: %s\n", fd_path, strerror(ret));
> + "test: %s\n", fd_path, ret > 0 ? strerror(ret) :
> + "channel not connected");
The indent is messy. I sugest this:
+ RTE_LOG(ERR, GUEST_CHANNEL,
+ "Error on channel '%s' communications test: %s\n",
+ fd_path, ret > 0 ? strerror(ret) :
+ "channel not connected");
> - RTE_LOG(DEBUG, POWER, "Error sending message: %s\n", strerror(ret));
> + RTE_LOG(DEBUG, POWER, "Error sending message: %s\n", ret > 0 ? strerror(ret)
> + : "channel not connected");
+ RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
+ ret > 0 ? strerror(ret) : "channel not connected");
Applied with above changes, thanks.
More information about the dev
mailing list