Thread (22 messages) 22 messages, 2 authors, 2021-10-19
STALE1706d LANDED
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 03/14] firmware_loader: add a sanity check for firmware_request_builtin()

From: "Luis R. Rodriguez" <mcgrof@kernel.org>
Date: 2021-09-17 18:23:22
Also in: linux-wireless, lkml
Subsystem: driver core, kobjects, debugfs and sysfs, firmware loader (request_firmware), the rest · Maintainers: Greg Kroah-Hartman, "Rafael J. Wysocki", Danilo Krummrich, Luis Chamberlain, Russ Weight, Linus Torvalds

From: Luis Chamberlain <mcgrof@kernel.org>

Right now firmware_request_builtin() is used internally only
and so we have control over the callers. But if we want to expose
that API more broadly we should ensure the firmware pointer
is valid.

This doesn't fix any known issue, it just prepares us to later
expose this API to other users.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/base/firmware_loader/main.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index eb4085b92ad4..d95b5fe5f700 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -115,6 +115,9 @@ static bool firmware_request_builtin(struct firmware *fw, const char *name)
 {
 	struct builtin_fw *b_fw;
 
+	if (!fw)
+		return false;
+
 	for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
 		if (strcmp(name, b_fw->name) == 0) {
 			fw->size = b_fw->size;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help