Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp1077944lqh; Fri, 29 Mar 2024 06:43:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWU00NC1wHUIPm8Eo+fcUCrQHK0ExhooQ5hn6nrLDohP0Y5Lbt4cTlVIMK7YDD+NmCk4eLjDhq05boMccfU2627Gm5ZUQMCzOlKjAvN6A== X-Google-Smtp-Source: AGHT+IEholYp5VQnlFwd0o7ROw8RgdGwNPddqL16rCek46yPD3DKEhrqpPj5yxOwWIM5NPumeWP5 X-Received: by 2002:a17:906:39b:b0:a4d:f8e5:575 with SMTP id b27-20020a170906039b00b00a4df8e50575mr1506384eja.53.1711719833270; Fri, 29 Mar 2024 06:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711719833; cv=pass; d=google.com; s=arc-20160816; b=ytHZZVRPM1GMvMe28WlY2cdoCnZpyCGfyDsE96ybLs5udllI5DDhCp/GY2RHShzbGa 8BcWKE6sHvn/yE4ZilDokfghBJ1P0W7yx6zc6DBTlrQnT2P58i+3651zZxNi1rzyYeEA KXfb//iqtXyPgD6XaK8PdcFrWcNpIz9ayKoTqWnwk/cFER3SQ3ICVstJ+AvW6yaoIxTN hJZepOGqwn8aP5ihLbKgoQ2yVORSfuvWAxUtiQmp3vtM3vzVRh/9vJMG8wbz8Bzfhj2U 26Wc5QFN8YQ/Eakv8m/L5KMkh7xMxDOTdyUkHT78/D99DvXHoH9tl8VEqUiYYYv206BZ 7nxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TQYgXGii9dIXegCqN1Vaht+Z/ZwjwtIyjCYq4y9lzWE=; fh=cR+lz8CKFoyN2pdGyQKj/FU1e2cos/aW9ZMULtitGtU=; b=fI3svvR5aS04Zb2ZnRZqXoX8jRWPlOizr1K2JarVd0sVMRaDFHfuwKEzgLlaIp2SnI oqbRTMa7qDKbwokAi+Ew0FmR7QJZ0H4Nw2bDofr9NHkjbxcvRPcNBBoSw6YdcTBTHVet Yhx1EbZ7GjTMuQQA+KF8DLHMpKMZ589NJdo+GFr0YWRD1zf7CDVdbOyKC7ZOShM10Cix D5I3QkoawYY8Guh9NM6G1AkTLXC/eY6hJ486TfHvUR1sluKMtccwsAdd5CV/AfYbeAFS V/jR35WJFTPOiBEUUsHzXCeL3PqWB5pKu86Eu+yZGCyK5NLfqkP4ZqpEGlmbZyYRTfH5 X/8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="vJG7t/4w"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124758-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 a6-20020a170906684600b00a4e2e1470e6si974607ejs.238.2024.03.29.06.43.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124758-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="vJG7t/4w"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124758-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 069BA1F21930 for ; Fri, 29 Mar 2024 13:43:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B85E6147C9D; Fri, 29 Mar 2024 12:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vJG7t/4w" 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 DC61E17F36D; Fri, 29 Mar 2024 12:41:30 +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=1711716091; cv=none; b=MXPKUUQ/p/xTUm5tPrWoEacnMBMVh2AFDmlnVZD8QiI7lpjdy9/I8KxVCqHi+qs6rfj3ERy7gIS9bY7Y6mZqla2lbbynMpvLBMp6FDjIqjvXx4tUJiZGy81XcNGx5vEJtj573gNdxCW6g/xpUas+yEXIIxsnftr5eD3OqJo2thk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716091; c=relaxed/simple; bh=LgRgmxT9jx54hTmFgAykHaUQdMdqQrNb7S4KQJeQEsE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Db2+ufhMF4vdR0YbvogCxN3Sk1r4nS6sKUCUbrGiSdg1Z4NWUAYxBlr0pOXGBrh7Dx+WPSJKzh3kXyQJ0CW/jEdv4Dco1z2ZX/6Xsb4+lDFppmBW9DEB5Suu2DKAwmSc4Au6axOEmJOLIZxuHdjywQncaNyAh4L4KrJe7WL9HnM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vJG7t/4w; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 947FCC43394; Fri, 29 Mar 2024 12:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716090; bh=LgRgmxT9jx54hTmFgAykHaUQdMdqQrNb7S4KQJeQEsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJG7t/4w6ZyBDor+vihQfV8lTsQ1ZwnB2qOWqPnE8A7cTC61ek+tk3k7YTNYL0nvL Bz96hKPWgL/aWwr3lNAPP2I7lC9D170w7tle2Lz3IJ/jkxpycFtVNQQ6+8GRRbnqTn 6kKXjXhkvHSYiz7VzUcoCKnFKkb6uM967JC7Gy1pxYEmW3smxv+rdW2VP4VxSz7Rjt UFbYrL4u7aqh3qQYay24FLbg1U2w79vWvaCTFTkgkhbbWzLdgYTmrRW5DJ4aYoCtxn L/wBMLpjLNTxHp1tYC071YH4zaokX+Xkt4ZB8hE1HpKPKzRmNkvca1+P8rvXOj/XO5 Aa1AyMMMRYiXw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Markus Elfring , Thierry Reding , Sasha Levin , thierry.reding@gmail.com, jonathanh@nvidia.com, keescook@chromium.org, mperttunen@nvidia.com, justinstitt@google.com, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 49/98] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename() Date: Fri, 29 Mar 2024 08:37:20 -0400 Message-ID: <20240329123919.3087149-49-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-1-sashal@kernel.org> 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 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.2 Content-Transfer-Encoding: 8bit From: Markus Elfring [ Upstream commit 1315848f1f8a0100cb6f8a7187bc320c5d98947f ] The kfree() function was called in one case by the get_filename() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. Thus return directly after a call of the function “kzalloc” failed at the beginning. Signed-off-by: Markus Elfring Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/firmware/tegra/bpmp-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c index bbcdd9fed3fb6..4221fed70ad48 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -77,7 +77,7 @@ static const char *get_filename(struct tegra_bpmp *bpmp, root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL); if (!root_path_buf) - goto out; + return NULL; root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf, root_path_buf_len); -- 2.43.0