*/
int nla_ok(const struct nlattr *nla, int remaining)
{
- return remaining >= sizeof(*nla) &&
+ size_t r = remaining;
+
+ return r >= sizeof(*nla) &&
nla->nla_len >= sizeof(*nla) &&
- nla->nla_len <= remaining;
+ nla->nla_len <= r;
}
/**
return 0;
ghdr = nlmsg_data(nlh);
- if (genlmsg_len(ghdr) < NLMSG_ALIGN(hdrlen))
+ if ((unsigned) genlmsg_len(ghdr) < NLMSG_ALIGN(hdrlen))
return 0;
return 1;
goto errout;
}
- if (ops->co_hdrsize < GENL_HDRSIZE(0)) {
+ if ((size_t) ops->co_hdrsize < GENL_HDRSIZE(0)) {
err = -NLE_INVAL;
goto errout;
}
*/
int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
{
- return (remaining >= sizeof(struct nlmsghdr) &&
+ size_t r = remaining;
+
+ return (r >= sizeof(struct nlmsghdr) &&
nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
- nlh->nlmsg_len <= remaining);
+ nlh->nlmsg_len <= r);
}
/**
*/
void nlmsg_set_default_size(size_t max)
{
- if (max < nlmsg_total_size(0))
+ if (max < (size_t) nlmsg_total_size(0))
max = nlmsg_total_size(0);
default_msg_size = max;
}
}
- if (iov.iov_len < n ||
+ if (iov.iov_len < (size_t) n ||
msg.msg_flags & MSG_TRUNC) {
/* Provided buffer is not long enough, enlarge it
* and try again. */
else if (hdr->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *e = nlmsg_data(hdr);
- if (hdr->nlmsg_len < nlmsg_msg_size(sizeof(*e))) {
+ if (hdr->nlmsg_len < (unsigned) nlmsg_msg_size(sizeof(*e))) {
/* Truncated error message, the default action
* is to stop parsing. The user may overrule
* this action by returning NL_SKIP or