* [PATCH] staging: i2400m: use explicit host byte-order types in comparison
@ 2021-02-19 0:30 ` karthik alapati
0 siblings, 0 replies; 4+ messages in thread
From: karthik alapati @ 2021-02-19 0:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Lee Jones, Johannes Berg, Arnd Bergmann
Cc: devel, linux-kernel
convert le32 types to host byte-order types before
comparison
Signed-off-by: karthik alapati <mail@karthek.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: i2400m: use explicit host byte-order types in comparison
@ 2021-02-19 0:30 ` karthik alapati
0 siblings, 0 replies; 4+ messages in thread
From: karthik alapati @ 2021-02-19 0:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Lee Jones, Johannes Berg, Arnd Bergmann
Cc: devel, linux-kernel
convert le32 types to host byte-order types before
comparison
Signed-off-by: karthik alapati <mail@karthek.com>
---
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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: i2400m: use explicit host byte-order types in comparison
2021-02-19 0:30 ` karthik alapati
@ 2021-02-19 6:21 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-19 6:21 UTC (permalink / raw)
To: karthik alapati
Cc: Lee Jones, Johannes Berg, Arnd Bergmann, devel, linux-kernel
On Fri, Feb 19, 2021 at 06:00:47AM +0530, karthik alapati wrote:
> convert le32 types to host byte-order types before
> comparison
That says what you did, but not _why_ you did it. Please fix up and
resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: i2400m: use explicit host byte-order types in comparison
@ 2021-02-19 6:21 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-19 6:21 UTC (permalink / raw)
To: karthik alapati
Cc: devel, Johannes Berg, Lee Jones, linux-kernel, Arnd Bergmann
On Fri, Feb 19, 2021 at 06:00:47AM +0530, karthik alapati wrote:
> convert le32 types to host byte-order types before
> comparison
That says what you did, but not _why_ you did it. Please fix up and
resend.
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-19 6:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 0:30 [PATCH] staging: i2400m: use explicit host byte-order types in comparison karthik alapati
2021-02-19 0:30 ` karthik alapati
2021-02-19 6:21 ` Greg Kroah-Hartman
2021-02-19 6:21 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.