From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AAF2C3601E for ; Mon, 7 Apr 2025 14:02:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 03FF5406CF; Mon, 7 Apr 2025 14:02:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id swlx8pspnHqp; Mon, 7 Apr 2025 14:02:50 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 769AA4088B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1744034570; bh=fdnGVLfRkD9zRtMLTLReBFHsSrnFe+4EithzXUJo3ew=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=6/tR7fekUt84SXQaxC1glfttuHOPOKlZMnWQBk7AXKwkTCfdxVQFtj96Nacs5AL5N YMjpL8jIYDnv2Flq7cE4JYWyQGzSVxr4Zxmta4azvTrrLd2HP1RZfnTyjmeB0Cbxo+ MCNBYcZ0NipC6+pSGOLL0yhdHPFXVQTr++vHrUppfKweHnn8wGgNHheyisrJ2Blt6j nWRLCKa1nYbX0kOARWgEYdJiRs5K63z3Hi35Ye8URDfzz1eiJ/LgFePyLsF/j2gbg0 ES0YukWPqsYYGqPoxieDuIXAvVCSm6K+VT7Oh/V3Ub+Az+/Lnv0zk61yt/BKlX7pV6 VP6jEgbJH3SAA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 769AA4088B; Mon, 7 Apr 2025 14:02:50 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 9D31E1DE for ; Mon, 7 Apr 2025 14:02:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 829A160BCB for ; Mon, 7 Apr 2025 14:02:48 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qf924Ai8PKDM for ; Mon, 7 Apr 2025 14:02:48 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2604:1380:45d1:ec00::3; helo=nyc.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org D59BE60B16 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D59BE60B16 Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by smtp3.osuosl.org (Postfix) with ESMTPS id D59BE60B16 for ; Mon, 7 Apr 2025 14:02:47 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id C7A3CA48C47; Mon, 7 Apr 2025 13:57:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9351BC4CEDD; Mon, 7 Apr 2025 14:02:44 +0000 (UTC) Date: Mon, 7 Apr 2025 15:02:42 +0100 From: Simon Horman To: Xuanqiang Luo Cc: przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Xuanqiang Luo Message-ID: <20250407140242.GK395307@horms.kernel.org> References: <20250325020149.2041648-1-xuanqiang.luo@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250325020149.2041648-1-xuanqiang.luo@linux.dev> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744034566; bh=fR7PBr6tXm57kWHmOH6/mTwC1BYD8urfsW/j3fAdi+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sktWr8vfZzwR4iCxq07Y3isgrQymVdA1eK1vTdZIH01p+zpcGhsWAlsZSdD5jTfWC r3BMISYilhgVeeSnQMhpE9ENTOKOR7cCRU04HRN1htlhrvAbdEVdpUu2TsG5PHgvAy BjKKzoIo2LR9men2Rmi4Vfdxe6MnjwX2pmGtO1871I2fhqymPGKEbnwvplma9RIK9n UzRo7DVEtEk8vvEqVOWswqzhd9sO/QGeheGfjFjO/4ij+mrj5yq5hSpMccZYTnMaLd hiT8AVXpXT8BLnA5FTd3C/1QorD/mTFFIqCFyzjEqbyzxquLSvBPxncsHWO2NIzZwm uzVo6vxjg9Fhw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=sktWr8vf Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Tue, Mar 25, 2025 at 10:01:49AM +0800, Xuanqiang Luo wrote: > From: Xuanqiang Luo > > As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI > pointer values"), we need to perform a null pointer check on the return > value of ice_get_vf_vsi() before using it. > > v2: Add "iwl-net" to the subject and modify the name format. > > Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters") > Signed-off-by: Xuanqiang Luo Reviewed-by: Simon Horman > --- > drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > index 14e3f0f89c78..53bad68e3f38 100644 > --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) > dev = ice_pf_to_dev(pf); > vf_vsi = ice_get_vf_vsi(vf); > nit, but not need to repost because of this: it's seems nicer not to have not to have a blank line here. And instead, if one is really wanted, put it above the ice_get_vf_vsi() line. > + if (!vf_vsi) { > + dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id); > + v_ret = VIRTCHNL_STATUS_ERR_PARAM; > + goto err_exit; > + } > + > #define ICE_VF_MAX_FDIR_FILTERS 128 > if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) || > vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) { > -- > 2.27.0 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C16491B87CE for ; Mon, 7 Apr 2025 14:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744034566; cv=none; b=AtphIG6g22sEjmypOrXenixPJsKCg4eq5KYCEExCegwU8+/IwVqwfMC/Ty+Gku9ol9uu1H6jUXAKf4VBZHmRYfeJC0MA/bz46ylimzum7hv/BECx52FkIZe3EcoUH5CFh2ytpxPVoCepGK1hEg8RBSC8UBE+cLQdvS9Hh2jKh6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744034566; c=relaxed/simple; bh=fR7PBr6tXm57kWHmOH6/mTwC1BYD8urfsW/j3fAdi+8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DI5IASY7O7PiYWe1e6xCXTvyoPOSKti5KPtXP/mJFlgA3gPfK+XIc5rdw9UFtKRUbQId1fDYlWgCYtUU6tIB5fJKXxfJdU/7QXa8o1czqOR+mkMwmQ1cAJbXXHAz0Gyzq1lDB5o4p0ZIj4j8/6H9HI7hLwq6t3842y7MMAA1FvE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sktWr8vf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sktWr8vf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9351BC4CEDD; Mon, 7 Apr 2025 14:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744034566; bh=fR7PBr6tXm57kWHmOH6/mTwC1BYD8urfsW/j3fAdi+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sktWr8vfZzwR4iCxq07Y3isgrQymVdA1eK1vTdZIH01p+zpcGhsWAlsZSdD5jTfWC r3BMISYilhgVeeSnQMhpE9ENTOKOR7cCRU04HRN1htlhrvAbdEVdpUu2TsG5PHgvAy BjKKzoIo2LR9men2Rmi4Vfdxe6MnjwX2pmGtO1871I2fhqymPGKEbnwvplma9RIK9n UzRo7DVEtEk8vvEqVOWswqzhd9sO/QGeheGfjFjO/4ij+mrj5yq5hSpMccZYTnMaLd hiT8AVXpXT8BLnA5FTd3C/1QorD/mTFFIqCFyzjEqbyzxquLSvBPxncsHWO2NIzZwm uzVo6vxjg9Fhw== Date: Mon, 7 Apr 2025 15:02:42 +0100 From: Simon Horman To: Xuanqiang Luo Cc: przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Xuanqiang Luo Subject: Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() Message-ID: <20250407140242.GK395307@horms.kernel.org> References: <20250325020149.2041648-1-xuanqiang.luo@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250325020149.2041648-1-xuanqiang.luo@linux.dev> On Tue, Mar 25, 2025 at 10:01:49AM +0800, Xuanqiang Luo wrote: > From: Xuanqiang Luo > > As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI > pointer values"), we need to perform a null pointer check on the return > value of ice_get_vf_vsi() before using it. > > v2: Add "iwl-net" to the subject and modify the name format. > > Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters") > Signed-off-by: Xuanqiang Luo Reviewed-by: Simon Horman > --- > drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > index 14e3f0f89c78..53bad68e3f38 100644 > --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c > @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) > dev = ice_pf_to_dev(pf); > vf_vsi = ice_get_vf_vsi(vf); > nit, but not need to repost because of this: it's seems nicer not to have not to have a blank line here. And instead, if one is really wanted, put it above the ice_get_vf_vsi() line. > + if (!vf_vsi) { > + dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id); > + v_ret = VIRTCHNL_STATUS_ERR_PARAM; > + goto err_exit; > + } > + > #define ICE_VF_MAX_FDIR_FILTERS 128 > if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) || > vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) { > -- > 2.27.0 > >