From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="b+iOeAwy" 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: netdev@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