[PATCH] staging: i2400m: use explicit host byte-order types in comparison

From: karthik alapati
Date: Thu Feb 18 2021 - 19:31:44 EST


convert le32 types to host byte-order types before
comparison

Signed-off-by: karthik alapati <mail@xxxxxxxxxxx>
---
i wonder how these could be false-positives
drivers/staging/wimax/i2400m/fw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
index edb5eba0898b..13207c985a87 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -191,7 +191,7 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
int i;
u32 checksum = 0;
const u32 *checksum_ptr = (void *) cmd->payload;
- for (i = 0; i < cmd->data_size / 4; i++)
+ for (i = 0; i < le32_to_cpu(cmd->data_size) / 4; i++)
checksum += cpu_to_le32(*checksum_ptr++);
checksum += cmd->command + cmd->target_addr + cmd->data_size;
cmd->block_checksum = cpu_to_le32(checksum);
@@ -506,7 +506,7 @@ ssize_t __i2400m_bm_ack_verify(struct i2400m *i2400m, int opcode,
opcode, i2400m_brh_get_response(ack));
goto error_ack_failed;
}
- if (ack_size < ack->data_size + sizeof(*ack)) {
+ if (ack_size < le32_to_cpu(ack->data_size) + sizeof(*ack)) {
dev_err(dev, "boot-mode cmd %d: SW BUG "
"driver provided only %zu bytes for %zu bytes "
"of data\n", opcode, ack_size,
--
2.30.1