diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-11-13 19:12:08 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:25 -0500 |
commit | 5f3f24faf322e54752d1df00cdb768a013de5d1f (patch) | |
tree | 81a8bf76d9165d3f0798f2cbd6cb967d35b54d3c /drivers | |
parent | 2ee92d46c6cabedd50edf6f273fa8cf84f707618 (diff) |
[ATM] ambassador,firestream: "-1 >>" is implementation defined
6.5.7(5): The result of E1 >> E2 is E1 right-shifted E2 bit positions.
...
If E1 has a signed type and a negative value, the resulting value
is implementation defined.
So, cast -1 to unsigned type to make result well-defined.
[ Modified to use ~0U based upon recommendation from Al Viro. -DaveM ]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/atm/ambassador.c | 2 | ||||
-rw-r--r-- | drivers/atm/firestream.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 9fffa7af6db1..afa7d750a593 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -972,7 +972,7 @@ static int make_rate (unsigned int rate, rounding r, | |||
972 | } | 972 | } |
973 | case round_up: { | 973 | case round_up: { |
974 | // check all bits that we are discarding | 974 | // check all bits that we are discarding |
975 | if (man & (-1>>9)) { | 975 | if (man & (~0U>>9)) { |
976 | man = (man>>(32-9)) + 1; | 976 | man = (man>>(32-9)) + 1; |
977 | if (man == (1<<9)) { | 977 | if (man == (1<<9)) { |
978 | // no need to check for round up outside of range | 978 | // no need to check for round up outside of range |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 697ad82f6634..9c67df5ccfa4 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -512,7 +512,7 @@ static unsigned int make_rate (unsigned int rate, int r, | |||
512 | } | 512 | } |
513 | case ROUND_UP: { | 513 | case ROUND_UP: { |
514 | /* check all bits that we are discarding */ | 514 | /* check all bits that we are discarding */ |
515 | if (man & (-1>>9)) { | 515 | if (man & (~0U>>9)) { |
516 | man = (man>>(32-9)) + 1; | 516 | man = (man>>(32-9)) + 1; |
517 | if (man == (1<<9)) { | 517 | if (man == (1<<9)) { |
518 | /* no need to check for round up outside of range */ | 518 | /* no need to check for round up outside of range */ |