Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7183973rdb; Wed, 3 Jan 2024 07:17:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOW6NoNlwWWJw71ejJMuTuQ8zhicONi0TJP63EFhAln7CGRuwiA5NseuQHG9XYSTfogzbu X-Received: by 2002:a50:c111:0:b0:556:c883:4763 with SMTP id l17-20020a50c111000000b00556c8834763mr334107edf.119.1704295032119; Wed, 03 Jan 2024 07:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704295032; cv=none; d=google.com; s=arc-20160816; b=aDpjTsPA8hdirqURvEyE73K9rbQG4l4aT0px0AkqcAYCIzaieaJP0/f4qb6eaMF4Fb kQXr33ROe7aJ5TvQ9YAqN6ACR0iXDmXJjr/T8w5rW+QJ/q5jpZrObzAquo2DQXkGLzLX E/4ASxanNDLp6UTNMW/cXAq+kTv8uGrKtg/FfHFZqMFlg10rM9GYUs/xs715V2RypR0q VE19s/bpDf63S983uzbKzULP+jp+DWiutjczQMRLB4yr/8POmVkOOa5qE2imPwP5XeRU cyXNocwO0EYSsm3yIgq7TV7oXz7bsupud4cPhpRwzJ7VOljbF6oylCsQPpE+kTBEUnwP zCoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=IuXh48BAQbEdwA1TrRsSkNBESpC4cFsNlnC9KrshjaA=; fh=35OjPwAlzRnDkxUOSbbeIr382tXPnwD04KE7jOBdE5M=; b=idX6EHxubO3w22awlu3ukqvBV7O9SxafaM8IeoxxPAX6BLOc0bWPCH8ofxxux3tEOC COlU5ySmyvx7ptI4/CWBJPPiMJWIedJ5R9E8CAu1cFw01xWU29BIK8N5dyP5nFF5MavZ lMdWk8/mGJf65IjNoaMoD6Jz3KZgbguACQNy3ZdHrAZm/3LahA6GjmbVIFII8RSjBtLK AUmFCNf1okPCJSrx/f70AK2gt4L3BSW0UAv5kikXFKrPvn37XroUAuNNVa1BMFB0aylT ISgufZfTjbhKqn5r2uxp7LnircEszcq3JZjeSp1u4EheMQs1zRwoN/u+1wYj7DOlZIVJ CjXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=gjuyWpIF; spf=pass (google.com: domain of linux-kernel+bounces-15689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.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 t14-20020a056402524e00b005548f93ea00si9875541edd.589.2024.01.03.07.17.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 07:17:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15689-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=@mailbox.org header.s=mail20150812 header.b=gjuyWpIF; spf=pass (google.com: domain of linux-kernel+bounces-15689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.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 D9D581F24691 for ; Wed, 3 Jan 2024 15:17:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0B821B28E; Wed, 3 Jan 2024 15:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="gjuyWpIF" X-Original-To: linux-kernel@vger.kernel.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (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 8541A1B26C; Wed, 3 Jan 2024 15:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mailbox.org Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4T4tbs0ZVNz9stN; Wed, 3 Jan 2024 16:16:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1704295001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IuXh48BAQbEdwA1TrRsSkNBESpC4cFsNlnC9KrshjaA=; b=gjuyWpIFQp9owXYt+yhOUAOair3NQQNvAXllOaRD0rUDOhMJr2LZjnCTp+Sb/obKXFsS4m IX2sf329qhiaS/ZCZFSpC+8/SmKjXGMCi9Q67UCLSawNnVyKegbU5QjzuLQeSPxwdql6NU FuV+VWzKu3njPey5FYyq7RPdYZ0XNt8EdC2NrXK/SdqZHIGQFqr4ot82BH1+SiGYqfSO0I PV7trpSAwdtb0toiQtleokzH9Np0cjgS4hSsnVCz1bThYoSJSnUaTAuDNkHggfytNiK510 YdEbogxr4MJrxEZbFEwKC2XHQh5tHqr2NjXlRBe6wSbT6X+xlZd/cm6Vk97pCQ== Message-ID: <37647c33-7f9d-4763-8bf4-cfc5c9a811de@mailbox.org> Date: Wed, 3 Jan 2024 16:16:38 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection Content-Language: en-CA To: Markus Elfring , dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: LKML , cocci@inria.fr References: <9b1e7330-f4f6-47f8-a568-eaea1624bb6f@web.de> From: =?UTF-8?Q?Michel_D=C3=A4nzer?= In-Reply-To: <9b1e7330-f4f6-47f8-a568-eaea1624bb6f@web.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-META: a3tith5w19ocqf5if416i7ko7o9xc9da X-MBO-RS-ID: 90cb4ebc5a3fddc3ff6 On 2023-12-26 10:38, Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 26 Dec 2023 08:44:37 +0100 > > The kfree() function was called in one case by the > drm_property_create() function during error handling > even if the passed data structure member contained a null pointer. > This issue was detected by using the Coccinelle software. > > Thus use another label. > > Signed-off-by: Markus Elfring > --- > drivers/gpu/drm/drm_property.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c > index 596272149a35..3440f4560e6e 100644 > --- a/drivers/gpu/drm/drm_property.c > +++ b/drivers/gpu/drm/drm_property.c > @@ -117,7 +117,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, > property->values = kcalloc(num_values, sizeof(uint64_t), > GFP_KERNEL); > if (!property->values) > - goto fail; > + goto free_property; > } > > ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY); > @@ -135,6 +135,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, > return property; > fail: > kfree(property->values); > +free_property: > kfree(property); > return NULL; > } > -- > 2.43.0 > This change is pointless at best, kfree(NULL) works fine. Out of curiosity, what exactly did Coccinelle report? -- Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer