Search Linux Wireless

[PATCH] iw: Fix calculation of fractional multicast rates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to missing brackets around the "(int) rate * 10" expression
the float value of "rate" is converted to an integer first and
then multiplied which results for example in "50" instead of the
expected "55" for a give rate of 5.5 Mbps, resulting in an invalid
argument error from iw.

This patch simply puts the multiplication expression in brackets,
so that the type cast is performed on the result and not the
first operand.

Signed-off-by: Jo-Philipp Wich <jow@xxxxxxxxxxx>
---
 ibss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ibss.c b/ibss.c
index ca8a4ec..b70dee3 100644
--- a/ibss.c
+++ b/ibss.c
@@ -104,7 +104,7 @@ static int join_ibss(struct nl80211_state *state,
 		if (*end != '\0')
 			return 1;
 
-		NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int) rate * 10);
+		NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int)(rate * 10));
 		argv++;
 		argc--;
 	}
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux