From: Olaf Hering <[EMAIL PROTECTED]>
Date: Thu, 17 Nov 2005 10:06:36 +0100

> This change causes this:
> 
> net/llc/llc_c_ac.c: In function `llc_conn_ac_inc_npta_value':
> net/llc/llc_c_ac.c:998: warning: comparison is always true due to limited 
> range of data type
> net/llc/llc_c_ac.c:999: warning: large integer implicitly truncated to 
> unsigned type

Thanks for the report, I've fixed it like so:

diff-tree 381998241fd1fc635596f4e8ae835f0d64ca1ba2 (from 
2fce76afdb067fa3e7f8ee33c9fe366bd65887ea)
Author: David S. Miller <[EMAIL PROTECTED]>
Date:   Thu Nov 17 15:17:42 2005 -0800

    [LLC]: Fix compiler warnings introduced by TX window scaling changes.
    
    Noticed by Olaf Hering.
    
    The comparisons want a u8 here (the data type on the left-hand branch
    is a u8 structure member, and the constant on the right-hand branch is
    "~((u8) 128)"), but C turns it into an integer so we get:
    
    net/llc/llc_c_ac.c: In function `llc_conn_ac_inc_npta_value':
    net/llc/llc_c_ac.c:998: warning: comparison is always true due to limited 
range of data type
    net/llc/llc_c_ac.c:999: warning: large integer implicitly truncated to 
unsigned type
    
    Fix this up by explicitly recasting the right-hand branch constant
    into a "u8" once more.
    
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index 91fb6bc..8169f24 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -995,8 +995,8 @@ static int llc_conn_ac_inc_npta_value(st
                llc->dec_step = 0;
                llc->dec_cntr = llc->inc_cntr = 2;
                ++llc->npta;
-               if (llc->npta > ~LLC_2_SEQ_NBR_MODULO)
-                       llc->npta = ~LLC_2_SEQ_NBR_MODULO ;
+               if (llc->npta > (u8) ~LLC_2_SEQ_NBR_MODULO)
+                       llc->npta = (u8) ~LLC_2_SEQ_NBR_MODULO;
        } else
                --llc->inc_cntr;
        return 0;
@@ -1086,8 +1086,8 @@ int llc_conn_ac_inc_tx_win_size(struct s
        struct llc_sock *llc = llc_sk(sk);
 
        llc->k += 1;
-       if (llc->k > ~LLC_2_SEQ_NBR_MODULO)
-               llc->k = ~LLC_2_SEQ_NBR_MODULO ;
+       if (llc->k > (u8) ~LLC_2_SEQ_NBR_MODULO)
+               llc->k = (u8) ~LLC_2_SEQ_NBR_MODULO;
        return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to