Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp676492img; Thu, 21 Mar 2019 06:46:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH2QtbgZKw77K95sXBs8hRuVKxWutJYlDPijg9vr7NrE7OpU3CVeyQW9/78xT6cbL4OWW0 X-Received: by 2002:a65:50c8:: with SMTP id s8mr3399817pgp.308.1553175977890; Thu, 21 Mar 2019 06:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553175977; cv=none; d=google.com; s=arc-20160816; b=jc97Pvfr17RATOIVgbCKJ4uhG4t8iUTHW0IUmtHDmayT9zGvOmRhGRzXXr+44nPtEP oiarp4RTVIayqvtzfIQDaojyoBVEoHXTlFr1wwqrmvHRorQ1yra//O+YXEKndrh3gixN MFFSx845sr6tVzfeUWRutd4bHkeGAKQHYZdNHY7+VOToCd2PnQqnCYIawSd1c2Wgatxp 1Q1hsw28bIfea/HwkX+ZCT58ZfQGdYscDux4/LPs7KcWNqs4zHONz/BaNJ3clk64ix8F ztSWFbA56qY8u3BMqfvxd/OH6MZTvCSJsILZTje6ycTHvNr/1Q1CTigNsaplDr8+wJLI C9Uw== 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=qeJ/mwst1s9pZ8SN29DJto8SSrt12B5ep8c6bsVAZjkI/khhyudsw/sjW8xQyas3VF iegeifnb1AsYIb+JDG9Ar1CnGB9UeyKHqPQjYybAxdFo5PgphFP9vQPGJ220pPXsf4rH 2eK+oObqvW6ftsWTX0SFw4X9IkEtHxyS87d3hMLZl544RzCC6QafcknStA0spi4EuJSc VVT4a0x0ZqS9h+9bDwC2Ae5bGdchNv31mXpTV+e2hr1b/ifar9Xp2yMQk72OZg6AtS2w ieNIvGJeEJN69noYkplJdVHMgvZYgWBgtezjbEC6ZMErcWwJzaDRkc0BAyf2ELtEwp6Q EvuA== 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 t8si4150355pgp.174.2019.03.21.06.46.02; Thu, 21 Mar 2019 06:46:17 -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 S1728368AbfCUNkb (ORCPT + 99 others); Thu, 21 Mar 2019 09:40:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:36150 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728337AbfCUNk3 (ORCPT ); Thu, 21 Mar 2019 09:40:29 -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 6AB3EAF8C; Thu, 21 Mar 2019 13:40:27 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 1B5B3E00BF; Thu, 21 Mar 2019 14:40:27 +0100 (CET) Message-Id: <604737189b5346bdc8e95dd19a390525d6880512.1553170807.git.mkubecek@suse.cz> In-Reply-To: References: From: Michal Kubecek Subject: [PATCH net-next v4 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 , linux-kernel@vger.kernel.org Date: Thu, 21 Mar 2019 14:40:27 +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