[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210917182226.3532898-4-mcgrof@kernel.org>
Date: Fri, 17 Sep 2021 11:22:15 -0700
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: gregkh@...uxfoundation.org
Cc: bp@...e.de, akpm@...ux-foundation.org, josh@...htriplett.org,
rishabhb@...eaurora.org, kubakici@...pl, maco@...roid.com,
david.brown@...aro.org, bjorn.andersson@...aro.org,
linux-wireless@...r.kernel.org, keescook@...omium.org,
shuah@...nel.org, mfuzzey@...keon.com, zohar@...ux.vnet.ibm.com,
dhowells@...hat.com, pali.rohar@...il.com, tiwai@...e.de,
arend.vanspriel@...adcom.com, zajec5@...il.com, nbroeking@...com,
broonie@...nel.org, dmitry.torokhov@...il.com, dwmw2@...radead.org,
torvalds@...ux-foundation.org, Abhay_Salunke@...l.com,
jewalt@...innovations.com, cantabile.desu@...il.com, ast@...com,
andresx7@...il.com, dan.rue@...aro.org, brendanhiggins@...gle.com,
yzaikin@...gle.com, sfr@...b.auug.org.au, rdunlap@...radead.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 03/14] firmware_loader: add a sanity check for firmware_request_builtin()
From: Luis Chamberlain <mcgrof@...nel.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@...nel.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
Powered by blists - more mailing lists