Skip to contentSkip to conversation

fix sparse warnings

PATCH In review karthik alapati 2 participants 6 messages Feb 21, 2021 – Feb 24, 2021 Staging

lore
Share & tools
lore
#0 lore raw

cover fix sparse warnings

the following patches fixes two byte-order issues and fixes these sparse warnings

drivers/staging//wimax/i2400m/op-rfkill.c:89:25: warning: incorrect type in assignment (different base types)
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: expected restricted __le16 [usertype] length
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: got unsigned long
.
drivers/staging//wimax/i2400m/fw.c:514:27: warning: restricted __le32 degrades to integer

karthik alapati (2):
staging: wimax/i2400m: fix byte-order issue
staging: wimax/i2400m: convert __le32 type to host byte-order

 drivers/staging/wimax/i2400m/fw.c        | 2 +-
 drivers/staging/wimax/i2400m/op-rfkill.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/2 staging: wimax/i2400m: fix byte-order issue

fix sparse byte-order warnings by converting host byte-order type to __le16 byte-order types before assigning to hdr.length

---
 drivers/staging/wimax/i2400m/op-rfkill.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wimax/i2400m/op-rfkill.c +1 -1
index a159808f0..0f438ae6a 100644
@@ -86,7 +86,7 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
 	if (cmd == NULL)
 		goto error_alloc;
 	cmd->hdr.type = cpu_to_le16(I2400M_MT_CMD_RF_CONTROL);
-	cmd->hdr.length = sizeof(cmd->sw_rf);
+	cmd->hdr.length = cpu_to_le16(sizeof(cmd->sw_rf));
 	cmd->hdr.version = cpu_to_le16(I2400M_L3L4_VERSION);
 	cmd->sw_rf.hdr.type = cpu_to_le16(I2400M_TLV_RF_OPERATION);
 	cmd->sw_rf.hdr.length = cpu_to_le16(sizeof(cmd->sw_rf.status));
Signature · 1 line
2.30.1
#2 lore raw

PATCH 2/2 staging: wimax/i2400m: convert __le32 type to host byte-order

In reply to karthik alapati

fix sparse type warning by converting __le32 types to host byte-order types before comparison

---
 drivers/staging/wimax/i2400m/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wimax/i2400m/fw.c +1 -1
index 92ea5c101..f09de1810 100644
@@ -511,7 +511,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,
Signature · 1 line
2.30.1
author
#3 lore raw
In reply to karthik alapati
Quoted 11 lines · karthik alapati

the following patches fixes two byte-order issues and fixes these sparse warnings

drivers/staging//wimax/i2400m/op-rfkill.c:89:25: warning: incorrect type in assignment (different base types)
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: expected restricted __le16 [usertype] length
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: got unsigned long
.
drivers/staging//wimax/i2400m/fw.c:514:27: warning: restricted __le32 degrades to integer

Quoted 11 lines

karthik alapati (2):
staging: wimax/i2400m: fix byte-order issue
staging: wimax/i2400m: convert __le32 type to host byte-order

 drivers/staging/wimax/i2400m/fw.c        | 2 +-
 drivers/staging/wimax/i2400m/op-rfkill.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.1

ping?

#4 lore raw
Quoted 16 lines · karthek
Quoted 15 lines · karthik alapati

the following patches fixes two byte-order issues and fixes these sparse warnings

drivers/staging//wimax/i2400m/op-rfkill.c:89:25: warning: incorrect type in assignment (different base types)
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: expected restricted __le16 [usertype] length
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: got unsigned long
.
drivers/staging//wimax/i2400m/fw.c:514:27: warning: restricted __le32 degrades to integer

karthik alapati (2):
staging: wimax/i2400m: fix byte-order issue
staging: wimax/i2400m: convert __le32 type to host byte-order

Quoted 8 lines
Quoted 7 lines
 drivers/staging/wimax/i2400m/fw.c        | 2 +-
 drivers/staging/wimax/i2400m/op-rfkill.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.1

ping?

The merge window is open so no one is merging these types of fixes now. Wait until -rc1 is out, and then give the maintainer two weeks to look at your patch and get back to you.

regards,
dan carpenter

author
#5 lore raw
Quoted 24 lines · Dan Carpenter
Quoted 23 lines · karthek
Quoted 22 lines · karthik alapati

the following patches fixes two byte-order issues and fixes these sparse warnings

drivers/staging//wimax/i2400m/op-rfkill.c:89:25: warning: incorrect type in assignment (different base types)
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: expected restricted __le16 [usertype] length
drivers/staging//wimax/i2400m/op-rfkill.c:89:25: got unsigned long
.
drivers/staging//wimax/i2400m/fw.c:514:27: warning: restricted __le32 degrades to integer

karthik alapati (2):
staging: wimax/i2400m: fix byte-order issue
staging: wimax/i2400m: convert __le32 type to host byte-order

 drivers/staging/wimax/i2400m/fw.c        | 2 +-
 drivers/staging/wimax/i2400m/op-rfkill.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.1
Quoted 9 lines
Quoted 1 line

ping?

The merge window is open so no one is merging these types of fixes now. Wait until -rc1 is out, and then give the maintainer two weeks to look at your patch and get back to you.

regards,
dan carpenter

thanks dan, Got it.