This changes sk_run_filter()'s return type from int to unsigned.

Signed-off-by: Kris Katterjohn <[EMAIL PROTECTED]>

Zero all ready gets returned if an error occurs, and net/packet/af_packet.c
treats the return type as unsigned anyway. For some reason, under the BPF RET
statements, fentry->k and A were cast to unsigned when A is all ready unsigned
and they'd both be converted back to int! I dropped the cast on both; fentry->k
get converted anyway.

No other files need to be changed because no return values are really changed.

Thanks!

--- x/net/core/filter.c 2006-01-05 12:27:17.000000000 -0600
+++ y/net/core/filter.c 2006-01-05 17:02:32.000000000 -0600
@@ -75,7 +75,7 @@ static inline void *load_pointer(struct 
  * len is the number of filter blocks in the array.
  */
  
-int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
+unsigned sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int 
flen)
 {
        struct sock_filter *fentry;     /* We walk down these */
        void *ptr;
@@ -241,9 +241,9 @@ load_b:
                        A = X;
                        continue;
                case BPF_RET|BPF_K:
-                       return ((unsigned int)fentry->k);
+                       return fentry->k;
                case BPF_RET|BPF_A:
-                       return ((unsigned int)A);
+                       return A;
                case BPF_ST:
                        mem[fentry->k] = A;
                        continue;

--- x/include/linux/filter.h    2006-01-02 21:21:10.000000000 -0600
+++ y/include/linux/filter.h    2006-01-05 17:02:58.000000000 -0600
@@ -143,7 +143,7 @@ static inline unsigned int sk_filter_len
 struct sk_buff;
 struct sock;
 
-extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int 
flen);
+extern unsigned sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, 
int flen);
 extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
 extern int sk_chk_filter(struct sock_filter *filter, int flen);
 #endif /* __KERNEL__ */


-
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