From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 5B2181F130B for ; Tue, 27 Jan 2026 16:51:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769532676; cv=none; b=ZtG37GV9i1syk68rVgwxg+bX3yUCqz4B/wbDk/NhByCRiihG8Md1uXiNp60fA5b59R1VtH9MY32C/3EANg4JSf9R8+FacalWWa2ds3xIagVFacklxwCJyc0sPsl1ATj+CG2ZJiaODR5fLvGjeSVi+ui3zZM7B7mhVoBoR68anvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769532676; c=relaxed/simple; bh=MiXiUIs2ptSQbYwUZ2qbvhUhqOFqhMYho0KH0pV7c44=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AuE7QNg+6F67YAQQzXL4tzCGobRd17GnyqYzIGJvfkEjrchvPjmcoUjF7WbEGBuSx5IxOVeGt9GIg81az4WnRzrIvxSH5OWKVUmB+U1/JzVgh0UowXrboIIRKMeBKlV5JLDxcds0g1qcYoIOUlSsnB4h3bISvg4UgIdRr6DRSOg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=YWk6gscj; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="YWk6gscj" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BECBC4E422D4; Tue, 27 Jan 2026 16:51:10 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 92292606F5; Tue, 27 Jan 2026 16:51:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id ADF27119A8695; Tue, 27 Jan 2026 17:51:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769532669; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MiXiUIs2ptSQbYwUZ2qbvhUhqOFqhMYho0KH0pV7c44=; b=YWk6gscjerrfJ1VRAL1zMsEgeqjk/egmEJXkM2NUUxCw7gkEKbMEazVLkUeITYTKGP18M3 YSqhz2pwQ94+UQme/1n1yimxtaJnhub1jbvbDpfWTzLnlS9+jpKOFjlAlyCaopWFhP4etH eLkL4urNbcTY7oD8iCCsL35dgvweV4lYJK8JlMITgfnNXZ4XOhj9seoi9hu8YN3X0i76UE iFedursQdHqnuOUINa0KEQGyw4LuKAPb67qzZg2P+OF0/52eWUNdnlwwdKZTKdHYYP0zvI ukTr+G197sTAVbUU2Nr/n9To6oUL211VBw93stGjQCbrqxwX6LXhhdDjNNcXDQ== Date: Tue, 27 Jan 2026 17:51:03 +0100 From: Kory Maincent To: Zilin Guan Cc: horms@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, jianhao.xu@seu.edu.cn, kuba@kernel.org, linux-kernel@vger.kernel.org, marco.crivellari@suse.com, netdev@vger.kernel.org, pabeni@redhat.com, vadim.fedorenko@linux.dev Subject: Re: [PATCH net v3 1/3] net: liquidio: Fix off-by-one error in PF setup_nic_devices() cleanup Message-ID: <20260127175103.19831bd5@kmaincent-XPS-13-7390> In-Reply-To: <20260127151241.1144039-2-zilin@seu.edu.cn> References: <20260127151241.1144039-1-zilin@seu.edu.cn> <20260127151241.1144039-2-zilin@seu.edu.cn> Organization: bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) 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-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On Tue, 27 Jan 2026 15:12:39 +0000 Zilin Guan wrote: > In setup_nic_devices(), the initialization loop jumps to the label > setup_nic_dev_free on failure. The current cleanup loop while(i--) > skip the failing index i, causing a memory leak. >=20 > Fix this by changing the loop to iterate from the current index i > down to 0. >=20 > Also, decrement i in the devlink_alloc failure path to point to the > last successfully allocated index. >=20 > Compile tested only. Issue found using code review. Reviewed-by: Kory Maincent Thank you! --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com