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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 82155CEBF61 for ; Mon, 17 Nov 2025 13:11:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3C0F060DB7; Mon, 17 Nov 2025 13:11:43 +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 pWOlUrVRWRmD; Mon, 17 Nov 2025 13:11:42 +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 smtp3.osuosl.org EFBFA607CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1763385102; bh=01cC7ySHWhCFyMvXlU1Mt2SGt2tFSxfshKiVMAheuoI=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BRE3W60J1+2AKRl0+nQUZDhb6Yi005NVQSNeOEb27cKbp5LOBHihpRRT5zSJpavFn zSyMeRgQPMfKQLiPqZodGjzQAphU3FcHu22gZo/jEZBw0880zXne52W48FZq99p2se E9/eZu3VP1h1+s4UvpaaKSVPFBbgdia0MVrx58SuAxS6qkep5jOHwEJa8CZpxekxTF sgWtL2D/8FBaNUuSsZtC78jprs3F5TyEMH6OBTb0AQBm/uO/A1+ZjstjnPHDbwCNoV 3eZe7gFYtszzvHDvkB7+FjUW0hUB7Fkmvw55qvWK4/SiKQSNOmfZplkRhTeaIRD5Mm fn/drZJcw1rBw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id EFBFA607CB; Mon, 17 Nov 2025 13:11:41 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id DEF04158 for ; Mon, 17 Nov 2025 13:11:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C916640434 for ; Mon, 17 Nov 2025 13:11:40 +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 EzF9wJ_yLbLO for ; Mon, 17 Nov 2025 13:11:40 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::330; helo=mail-wm1-x330.google.com; envelope-from=dan.carpenter@linaro.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org C697140426 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C697140426 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by smtp4.osuosl.org (Postfix) with ESMTPS id C697140426 for ; Mon, 17 Nov 2025 13:11:39 +0000 (UTC) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-47798ded6fcso5697955e9.1 for ; Mon, 17 Nov 2025 05:11:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763385097; x=1763989897; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=01cC7ySHWhCFyMvXlU1Mt2SGt2tFSxfshKiV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Google-Smtp-Source: AGHT+IHBC+9FsxtsdSHIREVrp/G6htztuNX/oUndRO09FTt+ZBKnna4hH64IsewtZZFfCyMd6Zo6+A== X-Received: by 2002:a05:600c:a43:b0:477:3543:3a3b with SMTP id 5b1f17b1804b1-4778fe59f2amr105544325e9.6.1763385097412; Mon, 17 Nov 2025 05:11:37 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4779973ddcfsm130108955e9.15.2025.11.17.05.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 05:11:36 -0800 (PST) Date: Mon, 17 Nov 2025 16:11:32 +0300 From: Dan Carpenter To: Alexander Lobakin Cc: Ally Heev , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Aleksandr Loktionov , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Message-ID: References: <20251106-aheev-uninitialized-free-attr-net-ethernet-v3-1-ef2220f4f476@gmail.com> <575bfdb1-8fc4-4147-8af7-33c40e619b66@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <575bfdb1-8fc4-4147-8af7-33c40e619b66@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763385097; x=1763989897; darn=lists.osuosl.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=01cC7ySHWhCFyMvXlU1Mt2SGt2tFSxfshKiVMAheuoI=; b=alt/pJ9k61FTFi3Loz2PDri28lPnOww1jvg8xwwL1UqpTbY7WFNmjZJuGa/qag4pVo 0OIOVb3xlVajIfMIUaJ9LC+v1JFYqM03Uu/q1fX3M5D84TPmU0LlMPerZeTgiE9UosAY YQQmpl+V4ro+hMFunXmlKj6sT5aTxYCTBd70Ob1a32dYM2LNRB+9ob0vcrHu3enqFH83 6ur0Mqp7Vsu/gAyK+3YA5PbSMbcqyPRv27x5L9h4KY2fawHiYBbkbJXsCh5RSxxJ7oTK MF58k9G5HTsMTyj0Jm43aofMDaujph0eiNQoQCpeQDclE2M3vLZIh5WANNYeT1dak9k7 UfcA== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=linaro.org X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=alt/pJ9k Subject: Re: [Intel-wired-lan] [PATCH v3] net: ethernet: fix uninitialized pointers with free attribute 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 Thu, Nov 06, 2025 at 03:07:26PM +0100, Alexander Lobakin wrote: > > diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c > > index 6d5c939dc8a515c252cd2b77d155b69fa264ee92..3590dacf3ee57879b3809d715e40bb290e40c4aa 100644 > > --- a/drivers/net/ethernet/intel/ice/ice_flow.c > > +++ b/drivers/net/ethernet/intel/ice/ice_flow.c > > @@ -1573,12 +1573,13 @@ ice_flow_set_parser_prof(struct ice_hw *hw, u16 dest_vsi, u16 fdir_vsi, > > struct ice_parser_profile *prof, enum ice_block blk) > > { > > u64 id = find_first_bit(prof->ptypes, ICE_FLOW_PTYPE_MAX); > > - struct ice_flow_prof_params *params __free(kfree); > > u8 fv_words = hw->blk[blk].es.fvw; > > int status; > > int i, idx; > > > > - params = kzalloc(sizeof(*params), GFP_KERNEL); > > + struct ice_flow_prof_params *params __free(kfree) = > > + kzalloc(sizeof(*params), GFP_KERNEL); > > Please don't do it that way. It's not C++ with RAII and > declare-where-you-use. > Just leave the variable declarations where they are, but initialize them > with `= NULL`. > > Variable declarations must be in one block and sorted from the longest > to the shortest. > These days, with __free the trend is to say yes this is RAII and we should declare it where you use it. I personally don't have a strong opinion on this either way, but other maintainers do and will NAK the `= NULL` approach. The documentation says you should do it that way and avoid the `= NULL` as well. The issue is with lock ordering. It's a FILO ordering, so if we require a specific unlock order then declaring variables at the top could mess things up. The counter argument is that if you declare a variable after a goto then that's undefined behavior as well. Clang will detect that bug so it be detected before it hits actual users. regards, dan carpenter