Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp716693lqp; Thu, 21 Mar 2024 13:20:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoxFYxeB9D8GD9jd4vO4oARyWYhXsnusf0E38R5tKlRE41krICJyrBouRp8hrErNZsh0Mrrv/W2W/vhXY7zVxas1v8W1+dH478HktCqQ== X-Google-Smtp-Source: AGHT+IHs29Gi+KtTMXcFNtffyfgB6Ft5z+r/q3GNLwwAgQPJ4DjpZ+NmzZu9J4iUmZVOpU8sSBHD X-Received: by 2002:a19:4350:0:b0:513:c69f:ed28 with SMTP id m16-20020a194350000000b00513c69fed28mr293432lfj.58.1711052439791; Thu, 21 Mar 2024 13:20:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711052439; cv=pass; d=google.com; s=arc-20160816; b=Ri2yf5DVya7q3yJDHB/0uP6A12+UPgVk1kZbJHivPvUvP14qdQde3yvku32ORsEfHG lj3e1JTbbna6pQ+iWfzLbaS0cwatIPnCfm7XCI7cs7lZfYCpA6VD96v2mZHxu4NKDAgP nj8+RATbkYDu3WReNc2R4DlkiB8w7kwvOrUtqPyorYPui/ETMwlRH+0OMxoK4R6V2Ww9 qCk4uUEKukw/DhYQB4vtxuGL/elLEGIEw+NO6vsyRQ1iWCEIFnf1BGXHaAb1fcS37Ld1 h8PVXUZl/zDK+fcL2QR/hzxxFe3lcuy+JuQF7+GkkJ1cYQEtZSk3tjEHMskvwM4n8kZo pu/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:from :content-transfer-encoding:dkim-signature; bh=eFrHAh7BJNnqflbNawWUWzv1wOsF6n2g6fArJ0mZMlY=; fh=bxiCCg5ZR942c2Ji39owiXdgTg9OJYLC4NfQJ1h7ZAU=; b=daImOsIGp76QOJSd0TRpBseT2Ul7oWWDn7nXaBCR3O5P51k1zQRbHkko6xvTfWrwHx EUrTQtDSxGKP9FsGb/ey7AFsdmLVJ2MuYX1bitCND8zZJtRo60a6EHnoNvdvfTnImEPX eBEbGLBON7QqwLlf6syK9aLBpJAHsPagfOK13IYhAfGmFaPZ/ckE70VMnyqdOGdw2pST 3hEIPY1McI8hiDElwZRsCBXfxJHhOIT0FyFSr6NJL21beXJFobEI8KXFrb/MErOJQVIv qC/xwl4tHtOlba2oZVU8I2nhu4QqHutJOgYDQQVKPnPHVjrGqVVbsN1+L7OcTTVhNavC Pwxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=b+iOeAwy; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-110635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t12-20020a170906064c00b00a46c12e9fdbsi232076ejb.159.2024.03.21.13.20.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 13:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=b+iOeAwy; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-110635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8318E1F22DCF for ; Thu, 21 Mar 2024 20:20:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43FE1134CF2; Thu, 21 Mar 2024 20:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="b+iOeAwy" Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) (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 A0B9713442F; Thu, 21 Mar 2024 20:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711052428; cv=none; b=A0d2H9eMhfAb8eUHXEf7v0Z3aTndG+3QFrbF6QloFL63K6C6ctgzDO0VDxRHD+XjMTt730PBBLo8Qxcrb3hmRAJT7k8b9L3BVviMQ/vHPX9qFOKviRdLmxHt56GuTnTbHMhcljsJZUxHQ1ggsEMLWLfY18ujOny0+Y/VGd0SgpQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711052428; c=relaxed/simple; bh=eFrHAh7BJNnqflbNawWUWzv1wOsF6n2g6fArJ0mZMlY=; h=Content-Type:From:Mime-Version:Subject:Date:Message-Id:References: Cc:In-Reply-To:To; b=HBuwUnTrq3NSZ94qAPalJo5/CNSkP/oI/pKXuO/RYwWMz9qZJ+4xcaj/FjiEFWbcyun92kpixYHkX1raOVTB0G/7Ve3ieg/ArHWQZfTRT+aHMw0oPfyLjjuhI9o8wlPvZhedkJqbrI/h2gS/s8Ag9lil8LRxXMyFuqtU+Cg0cRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=b+iOeAwy; arc=none smtp.client-ip=192.134.164.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=content-transfer-encoding:from:mime-version:subject:date: message-id:references:cc:in-reply-to:to; bh=eFrHAh7BJNnqflbNawWUWzv1wOsF6n2g6fArJ0mZMlY=; b=b+iOeAwyum6sXPaLJdb+fWcvioaIay6A5QdvQAH59gWJUsmGC9jNdIvf /ahM63HH30yJBWqhsW2vS2WPc5h/9lkl9FlcxgEizgMNTAwfqQZw4FHWI d57CFM4Nc+XCYjiqBF+Y6RbCzR99H+QXO1yy2H4bghO54mhDp3Cik0xCj 0=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.07,143,1708383600"; d="scan'208";a="82803127" Received: from 184-074-243-067.biz.spectrum.com (HELO smtpclient.apple) ([184.74.243.67]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 21:20:12 +0100 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Julia Lawall Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (1.0) Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers Date: Thu, 21 Mar 2024 16:20:09 -0400 Message-Id: References: Cc: Andy Shevchenko , 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 , Kees Cook , Lukasz Czapnik , Paolo Abeni , Pucha Himasekhar Reddy In-Reply-To: To: Markus Elfring X-Mailer: iPhone Mail (19H384) Does one prefer an initialization of null at the top of the function or an i= nitialization to a meaningful value in the middle of the function ? (Sorry for top posting) Sent from my iPhone > On 21 Mar 2024, at 14:14, Markus Elfring wrote: >=20 > =EF=BB=BF >>=20 >>> How do you think about to reduce the scope for the affected local variab= le instead >>> with the help of a small script (like the following) for the semantic pa= tch language? >>>=20 >>> @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) =3D NULL; >>> if (ice_lbtest_create_frame(pf, &tx_frame, ...)) >>> { ... } >>> ... when any >>> +} >>> + >>> valid_frames =3D ice_lbtest_receive_frames(...); >>=20 >> I believe you don't understand what the scope of the above can be. >=20 > Will the understanding improve for the proposed source code transformation= ? >=20 > Regards, > Markus