Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp643257lqp; Thu, 21 Mar 2024 11:03:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZFlcKXdczfSIHaX2cfpLrEz6CwuT8PrLMPDqituHLDHALgsNzWs305KaH+lgWfesyOHClP17rtWSyTsJg1i6WhqecGAterxXswpiKlw== X-Google-Smtp-Source: AGHT+IGP7ZX1bKTClg8se61QiqnIPuzhFGGjJBULrtGPcSgZK/Siu527OSweBwO4vx3sEJ6hZ6Jr X-Received: by 2002:a05:6214:ccc:b0:696:236b:e1c7 with SMTP id 12-20020a0562140ccc00b00696236be1c7mr3320372qvx.52.1711044201955; Thu, 21 Mar 2024 11:03:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711044201; cv=pass; d=google.com; s=arc-20160816; b=Bdwh0mdpRq+5IzBRb7/a/jy1LdW6B5edxoFqYFvvVofqhfzI18vpaguUTInllth+M2 G2vg9Iuk7fB6uhCqxhwd478qmdrIhpAu/ij1avpHEQ3ZsPSU0cKB6M199rDCPseFfMOf H8fdnw0S98LpcoUOHb8SnnYu9iNDgaqsyMj5/4NsOg7/g4HstYWqcOCS8LSoVY63hKVS PcTsrHnfHIdcl2B6z2kL11yYKGIjFzWEtAUVWaY3PPR5Jnmz9/B9kUEIBBbaFg3ySQah 9NVU8o05I4UM5Z2s3ZxRFWfdM2oCpTaDRgxkzbX1pHuCW4k5TknNSqfdRfMHYPjvF8r2 CF3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nRNk8DmXe6CPB4/6YrKVTsejbGfE1zUOjTQsm19OqvI=; fh=VszdTUqcITby3i0k2EY3+btGXU8ukpmCeY8Y1W7iqs4=; b=qFHx5G2bYRi2VCxWGQAt1KOtzA1zb3u3dghoVjIKiYIx95WOENayD6LPEBrV2cb6JW ZQjki3bo/HtZb40AfHVZH5n8XGMjv6RXKEuSXsuc+vRlxDzJURefr7sQ0U8+y3A9eYM9 n0qqs1cHvmHmEcjAioq+/hC4DHWsHyJWjek23pwmW0D8qv5xfkRBczpO3sncTjqZEI8l KEaGpUGHrCTC0bOt5lnk2Ymaauue1v+VXkpaON4RUAHo5tr+PY4aYrCsXjkYX13mhlkf HXfYTqVzAdLfMLM7+FXgkh7/RRnakFM58fCdKdy6Is6s0ddRUEg+jOkH9NEU3RrJiUKR xZ0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LjblWkn4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110532-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110532-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g7-20020a0562140ac700b0068f960b1288si320018qvi.368.2024.03.21.11.03.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 11:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110532-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LjblWkn4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110532-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110532-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6E0F81C21D80 for ; Thu, 21 Mar 2024 18:03:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E0D81332BE; Thu, 21 Mar 2024 18:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LjblWkn4" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 D14C38613B; Thu, 21 Mar 2024 18:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711044191; cv=none; b=L57npTFC1/kvL3zKJXmSIDc+tb8TA7PGUMQYZEYZs2gg9NealoUK8Jax71jYsFkNRgwhqU88zCudTnhSmeK2bJFOEhObgRVuf91a1QRjm322kWIeF/vrOvz6xrmeu0aE+NSN51zIy03q7+9wHbqMD+rK2/1mG6cGH0Xt9EPaIxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711044191; c=relaxed/simple; bh=cpK068KVvFXrGJJCmc7jXbXiOVvPQ+oU7A4+RLoU+Qw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=foUGVIkfuTXwfNxmBI+ipS6iM8H2Seev4DCEe8ToO6SPXMb9eUKWmG3rXARWEel2JLFO3KQxmeRtuSn1sUcfWhVkXNhZor7NyegkizecCY+iTRSlQwieSRclzUwsEUMdNxRyyRMLAwHn9EcEPu/qIjxFLicBWEbxvxrYb00rVR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LjblWkn4; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711044190; x=1742580190; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=cpK068KVvFXrGJJCmc7jXbXiOVvPQ+oU7A4+RLoU+Qw=; b=LjblWkn46DoJ4D30T1Q4+Xd2HPvwa1M93IlbrFEIGc4mVKHokGBICI3L k1DV7xeY8QPHGYUMy0tVVOBiZnxjfeftq4YU77n1MWAnsZ/BEAMIY9/M7 oaH4WY8SApKWwNspi8MOYAtUd9IKT4dY70kznKAf2nW1rZ7r8tAImk8ik xwyoD0fAxtGAxRseivGItDo6DzvJ2ee3HGygKUfqQaF5KYv+fX1soZP5k nyhCpxkMqF8PNDNd0LYoU3ljR1uGPC8/2x0idbHxZNPJ7G/ykfxpeVyNh Bn02mls4QgT04iL1Cs6qIjrvVbGU323Or3xdjJBpT8/070h2lmqx61438 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6180634" X-IronPort-AV: E=Sophos;i="6.07,143,1708416000"; d="scan'208";a="6180634" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 11:03:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="914717075" X-IronPort-AV: E=Sophos;i="6.07,143,1708416000"; d="scan'208";a="914717075" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 11:03:04 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rnMkm-0000000ExcL-2Dkx; Thu, 21 Mar 2024 20:03:00 +0200 Date: Thu, 21 Mar 2024 20:03:00 +0200 From: Andy Shevchenko To: Markus Elfring Cc: Dan Carpenter , kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Maciej Fijalkowski , Przemek Kitszel , Tony Nguyen , LKML , Alexander Lobakin , David Laight , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jesse Brandeburg , Jiri Pirko , Jonathan Cameron , Julia Lawall , Kees Cook , Lukasz Czapnik , Paolo Abeni , Pucha Himasekhar Reddy Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers Message-ID: References: <77145930-e3df-4e77-a22d-04851cf3a426@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Mar 21, 2024 at 06:59:00PM +0100, Markus Elfring wrote: … > > +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c > > @@ -941,11 +941,11 @@ static u64 ice_loopback_test(struct net_device *netdev) > > struct ice_netdev_priv *np = netdev_priv(netdev); > > struct ice_vsi *orig_vsi = np->vsi, *test_vsi; > > struct ice_pf *pf = orig_vsi->back; > > + u8 *tx_frame __free(kfree) = NULL; > > u8 broadcast[ETH_ALEN], ret = 0; > > int num_frames, valid_frames; > > struct ice_tx_ring *tx_ring; > > struct ice_rx_ring *rx_ring; > > - u8 *tx_frame __free(kfree); > > int i; > > > > netdev_info(netdev, "loopback test\n"); > > How do you think about to reduce the scope for the affected local variable instead > with the help of a small script (like the following) for the semantic patch language? > > @movement@ > attribute name __free; > @@ > -u8 *tx_frame __free(kfree); > int i; > ... when any > if (ice_fltr_add_mac(test_vsi, ...)) > { ... } > + > +{ > +u8 *tx_frame __free(kfree) = NULL; > if (ice_lbtest_create_frame(pf, &tx_frame, ...)) > { ... } > ... when any > +} > + > valid_frames = ice_lbtest_receive_frames(...); I believe you don't understand what the scope of the above can be. -- With Best Regards, Andy Shevchenko