lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  9 Aug 2018 13:33:34 +0100
From:   Ben Whitten <ben.whitten@...il.com>
To:     afaerber@...e.de
Cc:     starnight@...cu.edu.tw, hasnain.virk@....com,
        netdev@...r.kernel.org, liuxuenetmail@...il.com, shess@...sware.de,
        Ben Whitten <ben.whitten@...rdtech.com>
Subject: [PATCH lora-next v2 4/8] net: lora: sx1301: convert load_firmware to take firmware directly

We just pass the pointer to firmware down to the function that loads
it.

Signed-off-by: Ben Whitten <ben.whitten@...rdtech.com>
---
 drivers/net/lora/sx1301.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c
index 7324001..3f2a532 100644
--- a/drivers/net/lora/sx1301.c
+++ b/drivers/net/lora/sx1301.c
@@ -287,13 +287,13 @@ static int sx1301_arb_ram_read(struct sx1301_priv *priv, u8 addr, u8 *val)
 	return 0;
 }
 
-static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const u8 *data, size_t len)
+static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const struct firmware *fw)
 {
 	u8 *buf;
 	u8 val, rst, select_mux;
 	int ret;
 
-	if (len > 8192)
+	if (fw->size > 8192)
 		return -EINVAL;
 
 	switch (mcu) {
@@ -330,7 +330,7 @@ static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const u8 *dat
 		return ret;
 	}
 
-	ret = sx1301_write_burst(priv, REG_MCU_PROM_DATA, data, len);
+	ret = sx1301_write_burst(priv, REG_MCU_PROM_DATA, fw->data, fw->size);
 	if (ret) {
 		dev_err(priv->dev, "MCU prom data write failed\n");
 		return ret;
@@ -342,18 +342,18 @@ static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const u8 *dat
 		return ret;
 	}
 
-	buf = kzalloc(len, GFP_KERNEL);
+	buf = kzalloc(fw->size, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
-	ret = sx1301_read_burst(priv, REG_MCU_PROM_DATA, buf, len);
+	ret = sx1301_read_burst(priv, REG_MCU_PROM_DATA, buf, fw->size);
 	if (ret) {
 		dev_err(priv->dev, "MCU prom data read failed\n");
 		kfree(buf);
 		return ret;
 	}
 
-	if (memcmp(data, buf, len)) {
+	if (memcmp(fw->data, buf, fw->size)) {
 		dev_err(priv->dev, "MCU prom data read does not match data written\n");
 		kfree(buf);
 		return -ENXIO;
@@ -395,7 +395,7 @@ static int sx1301_agc_calibrate(struct sx1301_priv *priv)
 		return -EINVAL;
 	}
 
-	ret = sx1301_load_firmware(priv, 1, fw->data, fw->size);
+	ret = sx1301_load_firmware(priv, 1, fw);
 	release_firmware(fw);
 	if (ret) {
 		dev_err(priv->dev, "agc cal firmware load failed\n");
@@ -523,7 +523,7 @@ static int sx1301_load_all_firmware(struct sx1301_priv *priv)
 		return -EINVAL;
 	}
 
-	ret = sx1301_load_firmware(priv, 0, fw->data, fw->size);
+	ret = sx1301_load_firmware(priv, 0, fw);
 	release_firmware(fw);
 	if (ret)
 		return ret;
@@ -540,7 +540,7 @@ static int sx1301_load_all_firmware(struct sx1301_priv *priv)
 		return -EINVAL;
 	}
 
-	ret = sx1301_load_firmware(priv, 1, fw->data, fw->size);
+	ret = sx1301_load_firmware(priv, 1, fw);
 	release_firmware(fw);
 	if (ret)
 		return ret;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ