Skip to contentSkip to conversation

drivers/net/wireless/iwlwifi/iwl-3945.c Fix type issue on 64bit

PATCH In review Darren Jenkins\ 2 participants 2 messages Jul 2, 2008 – Jul 4, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/wireless/iwlwifi/iwl-3945.c Fix type issue on 64bit

Quoted 1 line
Quoted 1 line

What about the format line in the IWL_DEBUG_RX that uses rate?

I had figured that as rate was only positive it would work as is. However you are dead right, there is no point in a patch removing one example of bad programming only to introduce another.

Here is the updated patch:

Coverity CID: 2265 NEGATIVE_RETURNS

"rate" is of an unsigned type, and the code requires a signed type. The following patch makes it so.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>

drivers/net/wireless/iwlwifi/iwl-3945.c +2 -2
index 62a3d8f..d97c025 100644
@@ -449,7 +449,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
 
 	if (print_summary) {
 		char *title;
-		u32 rate;
+		int rate;
 
 		if (hundred)
 			title = "100Frames";
@@ -487,7 +487,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
 		 *    but you can hack it to show more, if you'd like to. */
 		if (dataframe)
 			IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
-				     "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
+				     "len=%u, rssi=%d, chnl=%d, rate=%d, \n",
 				     title, fc, header->addr1[5],
 				     length, rssi, channel, rate);
 		else {
#1 lore raw
Quoted 9 lines · Darren Jenkins\
Quoted 1 line
Quoted 1 line

What about the format line in the IWL_DEBUG_RX that uses rate?

I had figured that as rate was only positive it would work as is. However you are dead right, there is no point in a patch removing one example of bad programming only to introduce another.

Here is the updated patch:

Quoted 6 lines

Coverity CID: 2265 NEGATIVE_RETURNS

"rate" is of an unsigned type, and the code requires a signed type. The following patch makes it so.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>

NACK. See my early post. "rate" should be u8. You just need another int index here.

Thanks,
-yi

Quoted 23 lines
drivers/net/wireless/iwlwifi/iwl-3945.c +2 -2
index 62a3d8f..d97c025 100644
@@ -449,7 +449,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
 
 	if (print_summary) {
 		char *title;
-		u32 rate;
+		int rate;
 
 		if (hundred)
 			title = "100Frames";
@@ -487,7 +487,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
 		 *    but you can hack it to show more, if you'd like to. */
 		if (dataframe)
 			IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
-				     "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
+				     "len=%u, rssi=%d, chnl=%d, rate=%d, \n",
 				     title, fc, header->addr1[5],
 				     length, rssi, channel, rate);
 		else {