mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename()
@ 2023-12-25 19:18 Markus Elfring
  2024-02-21 16:21 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2023-12-25 19:18 UTC (permalink / raw)
  To: linux-tegra, kernel-janitors, Jonathan Hunter, Justin Stitt,
	Kees Cook, Mikko Perttunen, Thierry Reding
  Cc: LKML, cocci

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 25 Dec 2023 20:03:56 +0100

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 <elfring@users.sourceforge.net>
---
 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 bbcdd9fed3fb..4221fed70ad4 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename()
  2023-12-25 19:18 [PATCH] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename() Markus Elfring
@ 2024-02-21 16:21 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2024-02-21 16:21 UTC (permalink / raw)
  To: linux-tegra, kernel-janitors, Jonathan Hunter, Justin Stitt,
	Kees Cook, Mikko Perttunen, Thierry Reding, Markus Elfring
  Cc: LKML, cocci

From: Thierry Reding <treding@nvidia.com>


On Mon, 25 Dec 2023 20:18:44 +0100, Markus Elfring wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename()
      commit: 1315848f1f8a0100cb6f8a7187bc320c5d98947f

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-21 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-25 19:18 [PATCH] firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename() Markus Elfring
2024-02-21 16:21 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®