Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp523667ybi; Wed, 3 Jul 2019 00:25:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/ozZel5F+ebgrvilPnN1wXbxxdGOJeCyXU/d8cnFxnGvQYux+Qc+Cs/AfcMq/bT2FJxO+ X-Received: by 2002:a17:90a:2567:: with SMTP id j94mr10921329pje.121.1562138727401; Wed, 03 Jul 2019 00:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562138727; cv=none; d=google.com; s=arc-20160816; b=f8qql24mQtJg9oVfClhItYrNPFQtncLmHk5BE/khQTKKP33+l1U4dOb1lQy/8CamhW tnFUJSIBEpuG9BfVEdkfE5hHioJnM6IBZ1eJwL4owrS9wRs5cnnZOi/1wFXJMzacOLoL FD2D3MmNLA6t7HXvpHxZRyUShLQmx5vltObV7gNTIiX5NddU25TEg9qpTfBojnsnQata pKAU0goaQSMfMbrvIU+u/E/gtPOIxrXIqmk/PMSoE5AU7NbVEkEwi5nD0SpYQVLii2te 1RaKwOFZee120T2TRYvJ7nDh/8w7kjlU9jX/DhWYaYB16V14OYPuPbF3prN4bR8rq+4m szqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=o97Qwjc2M+qca0G2g4XqhTdcZ+9eGC7cycQyQyCQYJM=; b=viTl1A15+vo8x62mwZ4cGwEf34xqxdTBnBuDHthI92e3TMpurLSZWMwZntSPJRkQgK ot1J765F79OLjCNyXcvyKxJP2pBQqegtAnXXFMaZiuy+DZbrchwHFMOXRa+atms/4lDd Ej0YpdzaC1XiPPznL/uhMCigEYfQrb1wB3CVEoXdvI2nWqf6zv9HlKCOeIajnmu3nwjm 7638w+otewNE1b3q0JCA8h40C2LlY0bL2Oi1xKkuexQVtJYo98RWbdS9pTteEMB2m64N IhZ7O9Qj5ppc7wBfYfsUZ1k2UumiLNMRmh9nd4d4aRQwEGsKClaUWt9Mp8idZRsdYPmH n0aw== 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 b3si1443281pls.52.2019.07.03.00.25.12; Wed, 03 Jul 2019 00:25:27 -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 S1727262AbfGCHX2 (ORCPT + 99 others); Wed, 3 Jul 2019 03:23:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:51422 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726327AbfGCHX2 (ORCPT ); Wed, 3 Jul 2019 03:23:28 -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 1123EAE2E; Wed, 3 Jul 2019 07:23:27 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 3615BE0159; Wed, 3 Jul 2019 09:23:26 +0200 (CEST) Date: Wed, 3 Jul 2019 09:23:26 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Jakub Kicinski , David Miller , Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v6 05/15] ethtool: helper functions for netlink interface Message-ID: <20190703072326.GI20101@unicorn.suse.cz> References: <44957b13e8edbced71aca893908d184eb9e57341.1562067622.git.mkubecek@suse.cz> <20190702183724.423e3b1e@cakuba.netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190702183724.423e3b1e@cakuba.netronome.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 02, 2019 at 06:37:24PM -0700, Jakub Kicinski wrote: > On Tue, 2 Jul 2019 13:50:04 +0200 (CEST), Michal Kubecek wrote: > > Add common request/reply header definition and helpers to parse request > > header and fill reply header. Provide ethnl_update_* helpers to update > > structure members from request attributes (to be used for *_SET requests). > > > > Signed-off-by: Michal Kubecek > > > diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c > > index 3c98b41f04e5..e13f29bbd625 100644 > > --- a/net/ethtool/netlink.c > > +++ b/net/ethtool/netlink.c > > @@ -1,8 +1,181 @@ > > // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note > > > > +#include > > #include > > #include "netlink.h" > > > > +static struct genl_family ethtool_genl_family; > > + > > +static const struct nla_policy dflt_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { > > + [ETHTOOL_A_HEADER_UNSPEC] = { .type = NLA_REJECT }, > > I think we want strict checking on all new netlink interfaces, and > unfortunately that feature is opt-in.. so you need to add: > > .strict_start_type = ETHTOOL_A_HEADER_UNSPEC + 1 > > To the first attr. Oops... I'll have to check again how this works. I thought using nla_parse_nested() instead of nla_parse_nested_deprecated() is sufficient to have everything strict checked. Michal