Merge branch 'enovance-sa_fixup'
https://github.com/thom311/libnl/pull/62 [thaller@redhat.com: I changed the original patches to indent with tabs (vs. spaces) and reworded the commit messages.] Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
commit
cea532d296
4 changed files with 16 additions and 12 deletions
|
@ -81,12 +81,13 @@ hfsc_get_sc(char *optarg, struct tc_service_curve *sc)
|
|||
{
|
||||
unsigned int m1 = 0, d = 0, m2 = 0;
|
||||
char *tmp = strdup(optarg);
|
||||
char *p = tmp, *endptr;
|
||||
char *p, *endptr;
|
||||
char *pp = tmp;
|
||||
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
p = strstr(p, "m1:");
|
||||
p = strstr(pp, "m1:");
|
||||
if (p) {
|
||||
char *q;
|
||||
p += 3;
|
||||
|
@ -99,10 +100,10 @@ hfsc_get_sc(char *optarg, struct tc_service_curve *sc)
|
|||
m1 = strtoul(p, &endptr, 10);
|
||||
if (endptr == p)
|
||||
goto err;
|
||||
p = q + 1;
|
||||
}
|
||||
pp = q + 1;
|
||||
}
|
||||
|
||||
p = strstr(p, "d:");
|
||||
p = strstr(pp, "d:");
|
||||
if (p) {
|
||||
char *q;
|
||||
p += 2;
|
||||
|
@ -115,10 +116,10 @@ hfsc_get_sc(char *optarg, struct tc_service_curve *sc)
|
|||
d = strtoul(p, &endptr, 10);
|
||||
if (endptr == p)
|
||||
goto err;
|
||||
p = q + 1;
|
||||
}
|
||||
pp = q + 1;
|
||||
}
|
||||
|
||||
p = strstr(p, "m2:");
|
||||
p = strstr(pp, "m2:");
|
||||
if (p) {
|
||||
p += 3;
|
||||
if (*p == 0)
|
||||
|
@ -126,7 +127,7 @@ hfsc_get_sc(char *optarg, struct tc_service_curve *sc)
|
|||
m2 = strtoul(p, &endptr, 10);
|
||||
if (endptr == p)
|
||||
goto err;
|
||||
} else
|
||||
} else
|
||||
goto err;
|
||||
|
||||
free(tmp);
|
||||
|
|
|
@ -51,7 +51,8 @@ static struct rtnl_meta_value *meta_alloc(uint8_t type, uint16_t id,
|
|||
value->mv_shift = shift;
|
||||
value->mv_len = len;
|
||||
|
||||
memcpy(value + 1, data, len);
|
||||
if (len)
|
||||
memcpy(value + 1, data, len);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -533,8 +533,10 @@ int xfrmnl_ae_parse(struct nlmsghdr *n, struct xfrmnl_ae **result)
|
|||
struct xfrm_replay_state_esn* esn = nla_data (tb[XFRMA_REPLAY_ESN_VAL]);
|
||||
uint32_t len = sizeof (struct xfrmnl_replay_state_esn) + (sizeof (uint32_t) * esn->bmp_len);
|
||||
|
||||
if ((ae->replay_state_esn = calloc (1, len)) == NULL)
|
||||
if ((ae->replay_state_esn = calloc (1, len)) == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto errout;
|
||||
}
|
||||
ae->replay_state_esn->oseq = esn->oseq;
|
||||
ae->replay_state_esn->seq = esn->seq;
|
||||
ae->replay_state_esn->oseq_hi = esn->oseq_hi;
|
||||
|
|
|
@ -990,7 +990,7 @@ static int xfrm_sa_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
|
|||
err = pp->pp_cb((struct nl_object *) sa, pp);
|
||||
|
||||
xfrmnl_sa_put(sa);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue