Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1103912lqp; Fri, 22 Mar 2024 05:57:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjhN2WDK6DsJ11C5kXq5Jfe/Cs87cc5loC2K/ue5LHdtC/zB/19Oq1alBQNULIZ+UBOrinWrK/n/qwOM8tWTTT4HYNlnzkzgAfUE9YJA== X-Google-Smtp-Source: AGHT+IFXNYKAOab9vP4VgyheBpLGaSQFSWDoWVbT6WGF3ED0yIGehlRlHjs+PpOgw+ocRYJmlcB3 X-Received: by 2002:a17:906:d295:b0:a47:1c98:937f with SMTP id ay21-20020a170906d29500b00a471c98937fmr1630933ejb.29.1711112274025; Fri, 22 Mar 2024 05:57:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711112274; cv=pass; d=google.com; s=arc-20160816; b=v69kPcNA1rbg8APzds9rr7JjI7KfE59y7rhIWl0JIfniu5e8/kE10GzVhonI2js+QA 1bOFRMByo5+mah8cdeBkxzeKG6+EEru+kpK/XKU1oE6do3OPpioqOa+KEcnuJoAm5Qmy YYdIS3D49NMcV1KQzMyGsSiS2aRPCYTOZkpCM7Mry8apeRGAr4V4sLeuHQVMwZBpevqq Bk7+Qmui81uAWjq9u+VaTRJlUvHVo6ZQ4qK0ICso0PJihPQfe6NZsiycX+QljNqgsaK7 HTtbUP/Hque26H5bn0JFdepTNgKWf6ncf3QcLHWzGs7O6ikDzQ5HCfpcI6EFEkenydBQ rVHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oOU41yqHsc2JOfg06tT7Wiq3jSb7rI6nDRxffU3WGr4=; fh=ESnCov9t1QyTtHjMGkk2iYdyc1D6Qxdn7TA+GPBUbow=; b=SblA9d7qStsFH9267rPAeU9XWtfm8T85ztJvB71BSLHa1GSE8w/O+H+8NhzIdI9j1r VcRv+qb/XvKwDxuaOgz5JUOeKG30Gjup/F5L5Q/07/s4qrVHM9xhsQmT7+DjNDH95oNO E8yephWFLYpLaGGwkrJomWUa5sxNHNtJo49FQ3VYpaatKIQAUiAQYU9+2eP++2LCmhQk hnfCramsPbWpnZOI1kkw5txbfj2fdPuUumPU4KcWVtz5uvJDuVJbW5tprgJtoqwjv35w eIYDkMsis+JQi5jEMP0e81WVI4E3lz3QtZwXmtmrUQGRYoY479y6UzzIEcU7zKVRYAzt TvFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mYOnqs3X; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ko7-20020a170906aa0700b00a46bd91bb97si873083ejb.92.2024.03.22.05.57.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 05:57:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mYOnqs3X; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 67CDA1F238F5 for ; Fri, 22 Mar 2024 12:57:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35E8C4597C; Fri, 22 Mar 2024 12:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mYOnqs3X" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5585F20DDB; Fri, 22 Mar 2024 12:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711112252; cv=none; b=eo3gtzWbc+3CGWl9hwH80+zNC7Eny8XskvDLHpXXuqPlmTwXiviZXvjeN5YcZk1hQgLJUoRoHVNfBqP6UjM2gFcdPiKaQzQAI2lJzYT6Y3dHVsKY5Y/8zYb/LFpWIU4x6qLzSSSpESNT6/398EMbFte7dfjRcjcYgykosCXEM4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711112252; c=relaxed/simple; bh=vi6qepP3WZqihtomx/Ad9yWtRNe/QyPnUUouWN8vfoc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K+Xx9z95nP8yTKu7kPKX1rTzd8Qyh6dGfYZdDZL5p4ME5nvjV40BzPAxf2WoXMCR1r4xWOJU7ZdYV29OpfSciCcepSLWpRtF/7H+AWR/pucz4e2dzLtIX4DMQbApmnJnqbmpZcP/qLhKXQb+dvoStgJ6Y8C8aAq6ChXCAPJOEe4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mYOnqs3X; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C3C3C433F1; Fri, 22 Mar 2024 12:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711112251; bh=vi6qepP3WZqihtomx/Ad9yWtRNe/QyPnUUouWN8vfoc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mYOnqs3XbPZ567x2XcqYUCB8z7YM6n71i0LA+G1lsomcgE09dZnAsQ5/jnVOTis/+ RPvyII8VqC0yle9uD7ZI419zJtCNjPgh2PUXSiKJa6Ta6yS7/N3S6qkotXWZpmYiaz ppB5rTjd2bgLZ0m95ihhxh1d4FPmSMv95QhZaPRoxFx9kfF/ZQNmP/sejCpxpxZTKH Ma1dDeNOZD/KjfsULlkpWSYR7ICpajzsaCRnPE6iAFhSyZzf5lcP9KnPGqq1J9QFaF lFRUdJHIeZy5ZsdhHsNZBIgz0JCqnnWZKZ2v1ra6cd3Grj9LXoI4gMoFBUQoNJv0Ak YtYq2gOuwo3Qg== Date: Fri, 22 Mar 2024 12:57:27 +0000 From: Simon Horman To: Dan Carpenter Cc: Maciej Fijalkowski , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Przemek Kitszel , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2 net] ice: Fix freeing uninitialized pointers Message-ID: <20240322125727.GE372561@kernel.org> References: <0efe132b-b343-4438-bb00-5a4b82722ed3@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=us-ascii Content-Disposition: inline In-Reply-To: <0efe132b-b343-4438-bb00-5a4b82722ed3@moroto.mountain> On Thu, Mar 21, 2024 at 05:42:12PM +0300, Dan Carpenter wrote: > Automatically cleaned up pointers need to be initialized before exiting > their scope. In this case, they need to be initialized to NULL before > any return statement. > > Fixes: 90f821d72e11 ("ice: avoid unnecessary devm_ usage") > Signed-off-by: Dan Carpenter > --- > v2: I missed a couple pointers in v1. > > The change to ice_update_link_info() isn't required because it's > assigned on the very next line... But I did that because it's harmless > and makes __free() stuff easier to verify. I felt like moving the > declarations into the code would be controversial and it also ends up > making the lines really long. > > goto goto err_unroll_sched; > > struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = > kzalloc(sizeof(*pcaps), GFP_KERNEL); Thanks Dan, I agree with the approach you have taken here. And I apologise that it's quite likely that I skipped warnings regarding these problems when reviewing patches that introduced them - I did not understand the issue that this patch resolves. Reviewed-by: Simon Horman