Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp102088rwb; Tue, 25 Jul 2023 12:36:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUSextenLxztps448TuNnBEbkC+2E6aOYo+QV27MsTf7fneoUofW1F1bX6mSYMYGepg1pR X-Received: by 2002:aa7:d78d:0:b0:522:2d0a:646 with SMTP id s13-20020aa7d78d000000b005222d0a0646mr5781540edq.26.1690313815512; Tue, 25 Jul 2023 12:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690313815; cv=none; d=google.com; s=arc-20160816; b=ggHCHVdY2w1riTiZzytklW5ckmusy+yFpiiTbW13OnWfp4k+9Jzh2PC7FChni0j3Sn 6ApqWfQp36ffUQ0Mz8xPQyDX5/aay02r+vGXCDPRlrU9jXURvsgDKw73Mo3g858JoqZ+ If88PkoNV8xYI6Fl/eE/Fj7HFLGoD25tLHoupv/6vkynzAz3tOivGiB2yDcIiLLpthx8 SrBgfKGnKKox+6JZQ29GmtwTPqnAYAUdOTr/obhGvrUixaZKbfyiHwPsVhjIBvNQ2Xd8 0gbk19RABCDSIEvUDdb7OPy6wkerSo/KS0J9sEYqNIiTMLOz64IYvjS97EzMNenTrJTE Xsew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wxYfooCWGWtbGHHEjcTYp9nGcw9a3Q9S7WpAijPPKLs=; fh=LLEtp7LUKaYIfonSyFhSAq18qAVrsdguAD73Neb23bI=; b=OH9GV9MpcuVrOQEVUxMi9JvSI+wiKNWjwYZbEUaLNUm0fF+0groT3ZgWOW/ivKRM2G joRTsBVjfkhddVQfDPII57jYGqKvuXKqoFrNFkOfJaUNZ52WBmU8pjruwyEWw2FKnS9L Y+wXK6uYEqNW43y0sVdJ7wCJTCU9dywlbGrL4SD5dX14Z8eyi/kaD518TQ9i2/lJx78k Xn9CVsA9q72Z6VDILwDB3W7faVWXGhuvT9OFCjjN0ndIqnYPteL8P+PHn6eUuybkPoM6 Vy/2MFRn/nkXAdflM35h/4wqUSFrQQjS+VSHpIAAk3ki7JJhvjiGn0KJHBfXaKp6xrlz a6Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SdcIkVwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056402134400b005223ab5506fsi2482270edw.546.2023.07.25.12.36.29; Tue, 25 Jul 2023 12:36:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SdcIkVwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbjGYShA (ORCPT + 99 others); Tue, 25 Jul 2023 14:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjGYSg6 (ORCPT ); Tue, 25 Jul 2023 14:36:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D27E11985 for ; Tue, 25 Jul 2023 11:36:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7149E61870 for ; Tue, 25 Jul 2023 18:36:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3088BC433C9; Tue, 25 Jul 2023 18:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690310216; bh=bjmPK5i8hRDzGjUnFu1I3rEttWK5DLd8NhrusoG1LHM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SdcIkVwfwM8nNchwnyAIYUyNEQfIrLNu4VzEIYuK/6yR399E7HquUzR/dEqLDwynl cs+FB8L8PqQoFeknYUPYeowW+xWD6OekN6l/qDJixjEoe/qvUSv000ZEbMnilgzoFK iWFmJyTNaRFJ9FXuDqJfTWqKLFHGv72a3Hf8BSbDFjglnjwciYyPG5YtvrCxnfokXZ f7VYTKBs5OGzYR725ZwuO+mGVGSSvWMD8y5bmlBdzNoKOPRJvrrWkOT7WUzs3fh+fk uvEePo1Adzoa0h0Eqnn0xXtyVmeLUJdR3LA+GNYvxiM94trezxoCn99BSE8nB7PLMY 2jvafCCIQiVjA== Date: Tue, 25 Jul 2023 21:36:52 +0300 From: Leon Romanovsky To: Jakub Kicinski Cc: Lin Ma , jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] i40e: Add length check for IFLA_AF_SPEC parsing Message-ID: <20230725183652.GR11388@unreal> References: <20230723075042.3709043-1-linma@zju.edu.cn> <20230724174435.GA11388@unreal> <20230724142155.13c83625@kernel.org> <20230725054046.GK11388@unreal> <20230725095327.385616f1@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725095327.385616f1@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 25, 2023 at 09:53:27AM -0700, Jakub Kicinski wrote: > On Tue, 25 Jul 2023 08:40:46 +0300 Leon Romanovsky wrote: > > > Empty attributes are valid, we can't do that. > > > > Maybe Lin can add special version of nla_for_each_nested() which will > > skip these empty NLAs, for code which don't allow empty attributes. > > It's way too arbitrary. Empty attrs are 100% legit, they are called > NLA_FLAG in policy parlance. They are basically a boolean. I afraid that these nla_length() checks will be copied all other the kernel without any understanding and netlink API doesn't really provide any hint when length checks are needed and when they don't. Thank