projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'pinctrl-v4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[cascardo/linux.git]
/
net
/
netfilter
/
nft_byteorder.c
diff --git
a/net/netfilter/nft_byteorder.c
b/net/netfilter/nft_byteorder.c
index
b78c28b
..
ee63d98
100644
(file)
--- a/
net/netfilter/nft_byteorder.c
+++ b/
net/netfilter/nft_byteorder.c
@@
-99,6
+99,7
@@
static int nft_byteorder_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[])
{
struct nft_byteorder *priv = nft_expr_priv(expr);
const struct nlattr * const tb[])
{
struct nft_byteorder *priv = nft_expr_priv(expr);
+ u32 size, len;
int err;
if (tb[NFTA_BYTEORDER_SREG] == NULL ||
int err;
if (tb[NFTA_BYTEORDER_SREG] == NULL ||
@@
-117,7
+118,12
@@
static int nft_byteorder_init(const struct nft_ctx *ctx,
return -EINVAL;
}
return -EINVAL;
}
- priv->size = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_SIZE]));
+ err = nft_parse_u32_check(tb[NFTA_BYTEORDER_SIZE], U8_MAX, &size);
+ if (err < 0)
+ return err;
+
+ priv->size = size;
+
switch (priv->size) {
case 2:
case 4:
switch (priv->size) {
case 2:
case 4:
@@
-128,7
+134,12
@@
static int nft_byteorder_init(const struct nft_ctx *ctx,
}
priv->sreg = nft_parse_register(tb[NFTA_BYTEORDER_SREG]);
}
priv->sreg = nft_parse_register(tb[NFTA_BYTEORDER_SREG]);
- priv->len = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_LEN]));
+ err = nft_parse_u32_check(tb[NFTA_BYTEORDER_LEN], U8_MAX, &len);
+ if (err < 0)
+ return err;
+
+ priv->len = len;
+
err = nft_validate_register_load(priv->sreg, priv->len);
if (err < 0)
return err;
err = nft_validate_register_load(priv->sreg, priv->len);
if (err < 0)
return err;