mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 20:00:09 +01:00
platform/netlink: use appropriate integer types in nla_policy
This commit is contained in:
parent
57d626c182
commit
76bcd78710
2 changed files with 5 additions and 5 deletions
|
|
@ -597,7 +597,7 @@ static int
|
|||
validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *policy)
|
||||
{
|
||||
const struct nla_policy *pt;
|
||||
uint16_t minlen;
|
||||
uint8_t minlen;
|
||||
uint16_t len;
|
||||
int type = nla_type(nla);
|
||||
|
||||
|
|
@ -609,7 +609,7 @@ validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *pol
|
|||
if (pt->type > NLA_TYPE_MAX)
|
||||
g_return_val_if_reached(-NME_BUG);
|
||||
|
||||
if (pt->minlen)
|
||||
if (pt->minlen > 0)
|
||||
minlen = pt->minlen;
|
||||
else
|
||||
minlen = nla_attr_minlen[pt->type];
|
||||
|
|
@ -619,7 +619,7 @@ validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *pol
|
|||
if (len < minlen)
|
||||
return -NME_UNSPEC;
|
||||
|
||||
if (pt->maxlen && len > pt->maxlen)
|
||||
if (pt->maxlen > 0 && len > pt->maxlen)
|
||||
return -NME_UNSPEC;
|
||||
|
||||
switch (pt->type) {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ const char *nl_nlmsghdr_to_str(const struct nlmsghdr *hdr, char *buf, gsize len)
|
|||
|
||||
struct nla_policy {
|
||||
/* Type of attribute or NLA_UNSPEC */
|
||||
uint16_t type;
|
||||
uint8_t type;
|
||||
|
||||
/* Minimal length of payload required */
|
||||
uint16_t minlen;
|
||||
uint8_t minlen;
|
||||
|
||||
/* Maximal length of payload allowed */
|
||||
uint16_t maxlen;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue