From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 207C629C343 for ; Wed, 3 Dec 2025 08:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764749385; cv=none; b=GxB57BXY5Tj33FnJ+fIrjrZnqomiPSHj6TI798BV+ES1bjWdkB0M4GKSIIK58k7mvWtmKd9d16H20pI+jj6rIHNb3kNLcpkJxNKKaUa9DwIYo2dQatXL2+AP7pwdhL/L6WId9i6170wzsjD0Yb9TYTQbYlxa+qg69mMIxpYTZdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764749385; c=relaxed/simple; bh=Qw1XIM7eSAhRoQYgDKc3vj7KReSh96uVF11Fo0SrVk8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=HUJVhiyao0h8MUqDaI4UAB7dQgqOFxfuLFdhL0bSonVnsMqA8aDJUly9L09QjgV95aQoWPeDiEbR8VRbfuSqvr8EH0uqWTlLbdDMHZfGMNqHk7o6T45uOAczRwjrvTR8Ncl09+o/lLn3ZXc3E6neseTKoLoIhFRAQflipkD8aio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nA1UG6TV; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nA1UG6TV" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-29d7b019e0eso1521005ad.2 for ; Wed, 03 Dec 2025 00:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764749383; x=1765354183; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Qw1XIM7eSAhRoQYgDKc3vj7KReSh96uVF11Fo0SrVk8=; b=nA1UG6TVBVTFpaKurwmZs7uBgaDnR6LAxkObfZrD/jN1Hfpwris6j8WunnfGJLDmtz ZSbDdlBh5s0lp1eeporYKe8cXbIUTpJgi5/yxNuqElNuxBb9igiAxtDKEszxqKkKiTsc CW34nppAyfmNABIGBsmyRAp0Ygh3CO5spNX3sSEiqPxZ9Q1TlmJTPB3Kl8MRQX8oZ7tp A9IEUfoIvat3tWLQ8m602dxkimK8ceMKkfzQXhRE8hSJ0QMUniV9/FWpEwxVx1uZ99X6 ByK5zQIswtkSjNQ2TO5K0wMKbGwtfqPxXgD9MUfCtby5SdBwJ7V82qQtZ39wp5l2t23n VjiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764749383; x=1765354183; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qw1XIM7eSAhRoQYgDKc3vj7KReSh96uVF11Fo0SrVk8=; b=G3eTFqjdD1LSE4msBxpOM6eW0Y3LDNQfKq60Q3PJG23YNMQJROEvIRY9MTVXJhgyVA p6aF6EWQIDRQCxYBw2yCIt6MXaw/4F3nbZpgFWDCS0Ce6C+oPn1oWEx0RfERf6oMi999 6GfdORE0I8c/lTj0uam4MepZ8fpGiZCjmVFmcye1W/A6GX7eC4QGUfRm/ghUINLozTqW 1pRx7MooDpMZmrH6/L8HonJ9pKKkF3rXVnWOh5ui9UhdoMezTjnVWr3LUjqrfQsYDUpz 9EzzIO59FCYb5WrKve3QO8InM006So0VpHS205oWvJOtjUSkBg3nkmJYX6pMy2Mo1cca FJxQ== X-Forwarded-Encrypted: i=1; AJvYcCUCydlOXAmTP/wdwVCE8GPrBtYsa2BLK6cbq7KWBt5bsVLi0iGE7aOEenlPlPgkERRWJ9edLRsi3s8yNrw=@vger.kernel.org X-Gm-Message-State: AOJu0Ywpc74GF5qCWuhg6+VllnwA3It3QVyPmJZJP4VyXsLYXzjX4iHg koXO0lS1c0c8nPsMP++Ntm5Z5aya2oY+OhhajrTW/db30z6v3QVJtjQ+ X-Gm-Gg: ASbGncvOjtdjTQAUTZlqtCT3VY56i5ADVYDHD5G9ML7ePJGrjj+BRSNzGEobWPyWAAQ Tj+Gi0Oq/NFSeF1KRCXYJwAhx9gyg8zB/BSmoBhk94C8EjWqo8Ps/Sagw6ejHKwuwWw+xC2dYgN 9obzyKqC5bUKzoINta+mZXWwhiOivPrlb/+dufWAfzjaL91+TaKX8cAzfvyDdhrgqVjqDKj8Q12 lyWXWunifrgTCBffkB4KFaTb/H69+8ML2FP9WfsCwfDfl7ru0RxpYQto4+OTg26hBeg0/l3m2fz vfEIRHL0/lHhNEw9FL6whM1CkJXp8+tTlipORLg4rt1rPBnxPKlVJsyOo+rVN7k0x7yR5yUNT4T 4TAqmLMoyUXJEnHgBi5AWZbyw2ooez2U1PNpLxvLRMGD9BxtnO4iJIWQofsq0pLG4l4yFNiLSDJ KWtmf+IsK26iCL X-Google-Smtp-Source: AGHT+IFAlfUiSP/0APry1y+m8EN2DB6nA1GfpdSjA37sLcnI7XG/xYfVBKXtv81HhltCS2vstIvzZA== X-Received: by 2002:a17:903:3807:b0:290:9332:eebd with SMTP id d9443c01a7336-29d6833d1b8mr19425575ad.10.1764749383315; Wed, 03 Dec 2025 00:09:43 -0800 (PST) Received: from [192.168.1.4] ([106.215.171.188]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29bce441ae7sm175527585ad.25.2025.12.03.00.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Dec 2025 00:09:42 -0800 (PST) Message-ID: Subject: Re: [Intel-wired-lan] [RFT net-next PATCH RESEND 0/2] ethernet: intel: fix freeing uninitialized pointers with __free From: ally heev To: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexander Lobakin Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Dan Carpenter Date: Wed, 03 Dec 2025 13:39:31 +0530 In-Reply-To: References: <20251124-aheev-fix-free-uninitialized-ptrs-ethernet-intel-v1-0-a03fcd1937c0@gmail.com> <81053279-f2da-420c-b7a1-9a81615cd7ca@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-0+deb13u1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2025-12-02 at 10:17 -0800, Tony Nguyen wrote: >=20 > On 12/2/2025 11:47 AM, ally heev wrote: > > On Mon, 2025-12-01 at 13:40 -0800, Tony Nguyen wrote: > > >=20 > > > On 11/23/2025 11:40 PM, Ally Heev wrote: > > > > Uninitialized pointers with `__free` attribute can cause undefined > > > > behavior as the memory assigned randomly to the pointer is freed > > > > automatically when the pointer goes out of scope. > > > >=20 > > > > We could just fix it by initializing the pointer to NULL, but, as u= sage of > > > > cleanup attributes is discouraged in net [1], trying to achieve cle= anup > > > > using goto > > >=20 > > > These two drivers already have multiple other usages of this. All the > > > other instances initialize to NULL; I'd prefer to see this do the sam= e > > > over changing this single instance. > > >=20 > >=20 > > Other usages are slightly complicated to be refactored and might need > > good testing. Do you want me to do it in a different series? >=20 > Hi Ally, >=20 > Sorry, I think I was unclear. I'd prefer these two initialized to NULL,= =20 > to match the other usages, over removing the __free() from them. I had a patch for that already, but, isn't using __free discouraged in networking drivers [1]? Simon was against it [2] [2] https://lore.kernel.org/all/aQ9xp9pchMwml30P@horms.kernel.org/ [1] https://docs.kernel.org/process/maintainer-netdev.html#using-device-man= aged-and-cleanup-h-constructs Regards, Ally