Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3432065img; Mon, 25 Mar 2019 10:09:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQBFWdv5NCxyc4y6hKO1f8UaF4Qv2f967vCvr7UfTKkxNkIf8Oszl5ysBLR/vNuWAYnRV5 X-Received: by 2002:a62:a50c:: with SMTP id v12mr25726637pfm.206.1553533753420; Mon, 25 Mar 2019 10:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553533753; cv=none; d=google.com; s=arc-20160816; b=kt/Td2wZqs8Ic0qkRHiMnX58zN3zPRNaGFydcr+9sV6I+ALLu4DvmOdtENdTEcQ6mP 2+Ka54tCc2Cbtz/Yp/GQdEJhzphKp+wcywn9z4gzdqgPfzAIYlLjQH+I9lrVAvaR/4V2 2D44wU8YbsNbVJwX61zBlZ4nPaLL1HYkd0w488cnnTvwSTcRmimqUpZ02V2RVtrLHitB BHjvkQW3LVtUzhrhjTLTup6eUpFcUMqbhxXNetoZEndK6phIL6c/I9gcwBD9aeJxYjXK DoR51E2iiipIHb50VwpbRifZpWrZVbBOiqmwJA6zSNDwznWGCQPbxZyIGkpmsMViS2JS rdGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=Wq+ygeTf7CSFhTNdxuGHjgV8+okk3xhPCNTrw9yMVtA=; b=HQuJnhUXan7uPtASc/bfRibnXgZRPQkagRj0HUHOsJ0KLUEsXjsljuZGcc/Ij5XVAp A2MmUZeXJ0WKgFK/hbG1rU6Z4j+T2F+Twu+H8UOmiUOj/NzFDRHi2ZXJnkoapOQOv9rx WrWKaUKsnHvRV82MxvGNE16YaiggS36bLXya36xSu4ioEH/WRc6aYbXMUohL3MmoUhRi VzDg916G5KD8xtcP6d6rJokqpY75XitSmjM6tOS5fiH94cvxSOTvhYIlUYuPS0ZRERxn 8yDT++1AmUJ65/xq+T//EyzIsUrojgfRNpjhAf6zeqP00eBtJnPXA/peFv/h0rTf0bcV zqig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h29si5881580pfd.180.2019.03.25.10.08.58; Mon, 25 Mar 2019 10:09:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729992AbfCYRIG (ORCPT + 99 others); Mon, 25 Mar 2019 13:08:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:50876 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729489AbfCYRIF (ORCPT ); Mon, 25 Mar 2019 13:08:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E7BF6AFBB; Mon, 25 Mar 2019 17:08:03 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 99CA5E1404; Mon, 25 Mar 2019 18:08:03 +0100 (CET) Message-Id: <3a0ca34890256f86a4ca0c4f4582a0cff5af95ad.1553532199.git.mkubecek@suse.cz> In-Reply-To: References: From: Michal Kubecek Subject: [PATCH net-next v5 03/22] netlink: add strict version of nla_parse_nested() To: David Miller , netdev@vger.kernel.org Cc: Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , linux-kernel@vger.kernel.org Date: Mon, 25 Mar 2019 18:08:03 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to nla_parse_strict() and nlmsg_parse_strict(), add also nla_parse_nested_strict() as a version of nla_parse_nested() with strict policy checking. Signed-off-by: Michal Kubecek --- include/net/netlink.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/net/netlink.h b/include/net/netlink.h index bc0497076bec..723139637ba4 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -913,6 +913,15 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, extack); } +static inline int nla_parse_nested_strict(struct nlattr *tb[], int maxtype, + const struct nlattr *nla, + const struct nla_policy *policy, + struct netlink_ext_ack *extack) +{ + return nla_parse_strict(tb, maxtype, nla_data(nla), nla_len(nla), + policy, extack); +} + /** * nla_put_u8 - Add a u8 netlink attribute to a socket buffer * @skb: socket buffer to add attribute to -- 2.21.0