X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fnlattr.c;h=73635bdb006201d2a0e17cbca0cb945605b48f39;hb=refs%2Fheads%2Ftizen_8.0;hp=86029ad5ead4f23192c423e4e9659befac3c7f01;hpb=0b53abfc5f66449d42fb1738c1c191e29e3be2e4;p=platform%2Fkernel%2Flinux-rpi.git diff --git a/lib/nlattr.c b/lib/nlattr.c index 86029ad..73635bd 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -369,6 +370,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype, if (type <= 0 || type > maxtype) return 0; + type = array_index_nospec(type, maxtype + 1); pt = &policy[type]; BUG_ON(pt->type > NLA_TYPE_MAX); @@ -584,6 +586,7 @@ static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype, } continue; } + type = array_index_nospec(type, maxtype + 1); if (policy) { int err = validate_nla(nla, maxtype, policy, validate, extack, depth);