All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use explicit host byte-order types in comparison
@ 2021-02-19  0:21 ` karthik alapati
  0 siblings, 0 replies; 4+ messages in thread
From: karthik alapati @ 2021-02-19  0:21 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] use explicit host byte-order types in comparison
@ 2021-02-19  0:21 ` karthik alapati
  0 siblings, 0 replies; 4+ messages in thread
From: karthik alapati @ 2021-02-19  0:21 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] use explicit host byte-order types in comparison
  2021-02-19  0:21 ` karthik alapati
@ 2021-02-19  8:08   ` Dan Carpenter
  -1 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-19  8:08 UTC (permalink / raw)
  To: karthik alapati
  Cc: Greg Kroah-Hartman, Lee Jones, Johannes Berg, Arnd Bergmann,
	devel, linux-kernel

On Fri, Feb 19, 2021 at 05:51:59AM +0530, karthik alapati wrote:
> convert le32 types to host byte-order types before
> comparison
> 

Already fixed.  Please work against staging-next or linux-next.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use explicit host byte-order types in comparison
@ 2021-02-19  8:08   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-19  8:08 UTC (permalink / raw)
  To: karthik alapati
  Cc: devel, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel,
	Johannes Berg, Lee Jones

On Fri, Feb 19, 2021 at 05:51:59AM +0530, karthik alapati wrote:
> convert le32 types to host byte-order types before
> comparison
> 

Already fixed.  Please work against staging-next or linux-next.

regards,
dan carpenter
_______________________________________________
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  8:09 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:21 [PATCH] use explicit host byte-order types in comparison karthik alapati
2021-02-19  0:21 ` karthik alapati
2021-02-19  8:08 ` Dan Carpenter
2021-02-19  8:08   ` Dan Carpenter

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.