Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp31243lqz; Fri, 29 Mar 2024 07:42:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcQyBzvTtlQmRxhTrbSq6djiO18IW/xBJqgmUFJYyjReU2o1Edvwopsg59/V6jQKEHrvIno2ye3kgxg4Pwfk1fHov9rNhyV16CRCvRAg== X-Google-Smtp-Source: AGHT+IHOscLOBIXv+jm8CuXsEmaPJKoKO5sNGpyfLJkVkkFrDffAwo+6lUNTeoiTrYsfPDBHGdeT X-Received: by 2002:a50:cd9c:0:b0:56b:8dcd:acb5 with SMTP id p28-20020a50cd9c000000b0056b8dcdacb5mr1899299edi.39.1711723322458; Fri, 29 Mar 2024 07:42:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711723322; cv=pass; d=google.com; s=arc-20160816; b=oiJ+zpuuwrJl41PQY+6fty37JQoOEX+0ENV9CvAayPaBhja4xSiyB/dfIPTpcmtTW+ yjwIBUda/zgPsPKUPIgksnjj3CcdS0W+0Qzgx0bxCl8P9El4kau0aHkmeg2wY0kDAdrM SBZvJxlw4yalSFMV5wXMMzCSrySKap44uayO3v8PzHi6RyZQmZWZBs6H8+iLmAqe/JaQ OJKdcGk+WotezJcCOe0mA2T/25o8INLL9yep+DPwT9OFfK0EgmC27knCjBqK3GQFV5Br inwL3rmauxKK3K3tTr06kLYWMhHPvDKwkKQSReCkYbn3+FyQ99/OFvvu1KiUhbuoAe0g 7ntA== 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=8q/OeePx0veIrviyTTmYVvsL4XTt2UpHyMoAX1PnkGE=; fh=cR+lz8CKFoyN2pdGyQKj/FU1e2cos/aW9ZMULtitGtU=; b=xUeNEhBzekZ6I5CPCSb9P9pCrW8pWZF/oATBSHs71Wq2h0sy31n3jifAoVLPlTrOQu XeDiZohoKCda+OwpCsPpt+85K3yCqpHfrE/qfH9DlkMfqFC3uSKfBTAgBxXj+smnEjrK 1UV38Ya1nAWno88GJeQWSR/fmMRtUzhLvxu+MaYfkV3oYApl23PbUAYpEkqKwhIt7OG1 8OGChieCUc5CeLpIj0oN/AzBC2FQfwDj95KLeq27MBxCZhDtgXCFrQ6qdzO9RNPT1olp taexGn91XITKhBicOxwkar4jLz4iCHg/flWNtl+OBgebPVS65gnlyvDcS5iV4eNwJbdi iyww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jdQMOzO3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124905-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 bl21-20020a056402211500b0056c0d7e7a29si2019102edb.190.2024.03.29.07.42.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124905-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=jdQMOzO3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124905-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 AEBDD1F29C2F for ; Fri, 29 Mar 2024 14:23:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80ADD27BBA1; Fri, 29 Mar 2024 12:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jdQMOzO3" 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 83CD927BBCA; Fri, 29 Mar 2024 12:46:45 +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=1711716405; cv=none; b=bkv/VpTQOPpiyKKDc8DLfcyEm7/xhIl/LKQ9KWn+Sm26tZ7SKzyZFIljbe7mYrO1x9vy3EHRxFMND0V4RJxW4QAN3noFS/hXvEuLQj60Ha+0RpJfmrUYAJLGd3yguI+KikjGq8gQ0Y0W7Cq6AxUeypKpvOltARVLoPr5QzzED+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716405; c=relaxed/simple; bh=I2r9KSq9DUfKSFPDuayqPWnKFhzeb2NZosBa3x5Xb1c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u/ebNb1jG+qCQUb+G8ldpYdBw7Ah0myqv2gjBexmSlOmZHFK1DiLFKcl/ySy3ccj8sLHrG6eLgOltfKiWMlmDM4BLPzDMkhZYvpd7yNzCFBLgGmo2Lcscdy7M05ysTdy9oGogTL7QFLv/p3DzdFSWipeIOYO3Oe3zeYKR5e12dU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jdQMOzO3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA61FC43394; Fri, 29 Mar 2024 12:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716405; bh=I2r9KSq9DUfKSFPDuayqPWnKFhzeb2NZosBa3x5Xb1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jdQMOzO32N0uYoF6yH3fIDXRoctaBxSnvrE3K7abdrQArdYGWUfTEUCkktL5IPXhc 9Lp+JsRSwGkDqVCdcoezQl5LoM3NWrLRBP14Ihrt1uczpSwStbz77v8Ir2JDlX2YN4 wBZcxt/WlSpwqQl00RUfNYqsdPRyvZoldyQRJ/sR6a1xgZprETf57msuFel1XX87Zh JQqb6/ZmMtvEBIm59MzDESED4k1sev+w1re40NNZDJF5KvpFUJD+ibQeA0uh2YpoI0 WZvysGfrGc9PLNknEuqIYDAu6XmW6VFm6l3qy7xGe3f7JrgpRpaRKqTtseh7g5GRdw F1BlMvDK3x8lg== 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.1 21/52] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename() Date: Fri, 29 Mar 2024 08:45:15 -0400 Message-ID: <20240329124605.3091273-21-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org> References: <20240329124605.3091273-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.1.83 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 9d3874cdaaeef..34e4152477f3b 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -81,7 +81,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