Skip to contentSkip to conversation

"unsigned char"/"char" consistency?

PATCH In review Bart Samwel 2 participants 2 messages Jan 24, 2004

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

PATCH 1/1 "unsigned char"/"char" consistency?

Hi there,

I was just nosing around and I noticed a minor inconsistency in the usage of unsigned chars in skbuff push/pull functions. Almost all of these functions return unsigned chars, but there are two that return regular chars. Of course, this might be intentional, but AFAICS it probably isn't. If nobody has a reason why this must be like this, I suggest changing those two functions to return unsigned char as well. I've attached a patch that does this, it's against 2.6.2-rc1.

-- Bart

include/linux/skbuff.h +2 -2
diff -Naur linux-2.6.2-rc1/include/linux/skbuff.h linux-2.6.2-rc1-withunsigneds/include/linux/skbuff.h
@@ -871,7 +871,7 @@
 	return skb->data;
 }
 
-static inline char *__skb_pull(struct sk_buff *skb, unsigned int len)
+static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
 {
 	skb->len -= len;
 	BUG_ON(skb->len < skb->data_len);
@@ -895,7 +895,7 @@
 
 extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
 
-static inline char *__pskb_pull(struct sk_buff *skb, unsigned int len)
+static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
 {
 	if (len > skb_headlen(skb) &&
 	    !__pskb_pull_tail(skb, len-skb_headlen(skb)))
#1 lore raw

From: Bart Samwel <[email protected]>
Date: Sat, 24 Jan 2004 18:05:57 +0100

I was just nosing around and I noticed a minor inconsistency in the usage of unsigned chars in skbuff push/pull functions. Almost all of these functions return unsigned chars, but there are two that return regular chars. Of course, this might be intentional, but AFAICS it probably isn't. If nobody has a reason why this must be like this, I suggest changing those two functions to return unsigned char as well. I've attached a patch that does this, it's against 2.6.2-rc1.

Patch applied, thanks Bart.