Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp356377lqp; Thu, 21 Mar 2024 03:35:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpFZIU9jUov37XCIFt18JG45Z89wbXweka0aTA+1gt+9YVpYMdKQ+BbpuFDvitAhtCgA97B2/D9lu2c8yDHvgTGXH8qHpQDgxxm4fwog== X-Google-Smtp-Source: AGHT+IG3eJm9ywu1qSLinyue1ZjgJb3I4UIt8Y3QBxOMi+j/LPDUNS++4yM7dxtgoseW2dDalas2 X-Received: by 2002:a05:6358:789:b0:17e:f370:5308 with SMTP id n9-20020a056358078900b0017ef3705308mr13305180rwj.29.1711017310141; Thu, 21 Mar 2024 03:35:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711017310; cv=pass; d=google.com; s=arc-20160816; b=VyWCVKw7BMGoapTPANgiI6ckwnUIlDRrtK7QhKsFSSjrpn/MI0qvq/RayU7k+gJNGR e4NHyFIauYzWwgGkYfEUtSPzkiJaDm/oYOw94JKwhpDmvjsQjh7yiLUV19xQjIe5ggBR tWvAOXhzqog+CQiFok0vdOL0avGyUwuD4rhSRduTONdhk3EbcTypbAI9hcFeaGBVwHCO 4uxDop1YL9PmCoclH7Fl+7yfwrwcGTPacZi3DNbCR8dVRaNm+/nLnY+KisIY5pjHgb9Z qB0qJw4GAaoOpHNpTPCUMyrDNrX3Sm1X1Lw/8H1kmoKM3fpPYXn4Q67v9+nRbx+9TmoO UrLw== 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=3XNkgAQnQ6LBfF2NFDRpA/pvI0NsrzPvIEpAHL8Ayt0=; fh=gh/i6Q+B6OTmHmJHoAU3CLc8hScVB+yChtqGNxCyFdo=; b=UnK/zU3Uymi3WoC96HUIHmX4p7et0XSvH/p9EeBx5LzRvsTI4jHBwZvAUsrQzwv7f/ ax5Ck6mm8/d5lMRuL9q3YX+9YhZWv4yD2iCQYd4xrbVHri4IUeFrpHgNm1z04Hnp/tya WdnW88cxcUqMpgUZaSkvK5PlG5ItRKEzky7j9kKvUHZmESL8c/608JeYsGzK6xLCiyvU kxVA6KwTuSh4wr+0oZ1rotRmPoetr8BZbZdTDwWBJcxf6CYxtRMfHsbt88B4rfNrXqbX otjhRmVIsvO757xR/ZCPXAYXzbWbmNJNn0Xg472K+Ba21H72p6HsGjMXvmGmxam+EFEw KJpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F+bdIDkG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-109900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u185-20020a6379c2000000b005dc365174desi14166335pgc.377.2024.03.21.03.35.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 03:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F+bdIDkG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-109900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C86FA28308A for ; Thu, 21 Mar 2024 10:35:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53FA2433D5; Thu, 21 Mar 2024 10:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="F+bdIDkG" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 B68CC1CA9A for ; Thu, 21 Mar 2024 10:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711017297; cv=none; b=N/QxvoHZLBvlqeaOx+cS7Oq1HW3nHxi/cExrmUs/p/Lj/he7bEKqhO7bSUET5QLKOszvPs0CK3T2axxCgY1U3hptw9RnF5gW8e/XxYywTuCOGP6wLUJngx5fbxOTZFYMYlw/vzjdGKuCkrRtEYYNtIa8XYbwh74FBv5co1z3Kjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711017297; c=relaxed/simple; bh=y4emFXGGAZffpUX9wn8XGyawcIby/7BxyXLMzGwuUlE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cvece5Gf+Or1C+6iMkJfqJBpD9v+z0B5XQNJz6CxaaGBgMUmCm8HleEsRHSETzW3bC2phlldrqa+WHey3gStrZmx1YYo2L5VCS6TqZyeAhpQLPnJYytM/8JAs3JRffB3WnGSugQzb/OAT7+9I8RlDZ7IkFQtJ67fmDE36tNJd/Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=F+bdIDkG; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-513e89d0816so1052043e87.0 for ; Thu, 21 Mar 2024 03:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711017294; x=1711622094; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3XNkgAQnQ6LBfF2NFDRpA/pvI0NsrzPvIEpAHL8Ayt0=; b=F+bdIDkGzDaBLrdVKjtUiTAA/Dz/rG/yZGAAhu9b6bZyDlDxnqHH/dnruulUpT+v9U R3k8FXVXkP5Vq0vtxbabSaL+XA0fAnef5O1D9JX08rrjYnvo84uNaVDZBdQYIMM5jokC YznDdInJHUrbrEbKHBeOXvKRF9lEfTLkRcGHaQaxi5egEiWqt7h89143Lvlujrqlh+dE X+T/LB0p+6GND7LVAf3d1BkYxUAegyQs65YCKSP4815PMQefPb3OW/Rujv3nY4KGuNWy OzTCtUB0OCifQdV4X5hnlscNLyoGHMwOluJ9eJzeI+AmbiQ3GHtiqogejqO2TjiZwhCB 0RzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711017294; x=1711622094; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3XNkgAQnQ6LBfF2NFDRpA/pvI0NsrzPvIEpAHL8Ayt0=; b=rdiZ45au96RYFMUqzGlRq8Te/syYlA2IkKRY9jvLW4w2e9b3EK1Kcu3PSHBCFjERzi PUr+JGmoe67JCPiIKkWxrBhg5TNxN+WJNoTmGhAfSom3K7//T/CA8alWbj6exzyN0PeN dYfI84x2Z8a/hG+ZqqVggDEhgh8fHT+CEKabm1PHIOnVknWiw9db3vd9p05yzBOrhPwq 6No/lVYPz/jONv14HuDiAfrQ6/hcOuWfRqgf6sdlTD5jW4x37D0cna7WEpYpEDgDu+EL NKaKzuuomDZGu22H/eF7rANAXkvdRUf5Z3gEFf7nhByVHqCrz7Iu9VZgbuWzrbunEGbz 2J8w== X-Forwarded-Encrypted: i=1; AJvYcCUjL3cMh/5i84dhBbUHrdCxpdgeZWZaNjGf+RprnBk//YZnk+CrLX37QhkkT3OG6FHsQ02Iu2WQN8gJ2gJMHbgSWjdgxRMewQsd1a+O X-Gm-Message-State: AOJu0Yx4+si2BxAf+rcm5HbfXKh61j1CRLNn6+3EIBA2Erd3iCVJfJKL FIo5f+3V0Bs6wvaljIb67vh4LXadhhVD0tgbR6pKcOQe5iiLNT++cMmu9uPzw24QCzsqIEHOY9W 9 X-Received: by 2002:ac2:5b8f:0:b0:513:ec32:aa8a with SMTP id o15-20020ac25b8f000000b00513ec32aa8amr5682658lfn.11.1711017293674; Thu, 21 Mar 2024 03:34:53 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id iv20-20020a05600c549400b004146bce65f4sm5064318wmb.13.2024.03.21.03.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 03:34:53 -0700 (PDT) Date: Thu, 21 Mar 2024 13:34:48 +0300 From: Dan Carpenter To: Przemek Kitszel Cc: Jakub Kicinski , Maciej Fijalkowski , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Paolo Abeni , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Alexander Lobakin , Andy Shevchenko , Kees Cook , David Laight , "Czapnik, Lukasz" Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers Message-ID: <22ba28d7-e8ed-4b5a-9b6f-42d944d2f67d@moroto.mountain> References: <77145930-e3df-4e77-a22d-04851cf3a426@moroto.mountain> <20240319124317.3c3f16cd@kernel.org> <20240320202916.2f2bda73@kernel.org> <6266c75a-c02a-431f-a4f2-43b51586ffb4@intel.com> 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: <6266c75a-c02a-431f-a4f2-43b51586ffb4@intel.com> On Thu, Mar 21, 2024 at 10:59:42AM +0100, Przemek Kitszel wrote: > Simplest solution would be to add a macro wrapper, especially that there > are only a few deallocation methods. > > in cleanup.h: > +#define auto_kfree __free(kfree) = NULL > > and similar macros for auto vfree(), etc. > > then in the drivers: > -struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL, > *othercaps __free(kfree) = NULL; > +struct ice_aqc_get_phy_caps_data *pcaps auto_kfree, > *othercaps auto_kfree; The auto_kfree looks like a variable to my eyes. I'd prefer something like: #define __FREE(p) p __free(kfree) = NULL struct ice_aqc_get_phy_caps_data *__FREE(pcaps); regards, dan carpenter