Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
9c4d8938
Commit
9c4d8938
authored
Jun 18, 2003
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Use unlikely and BUG_ON in SKB assertions.
parent
542b8ab9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
include/linux/skbuff.h
include/linux/skbuff.h
+7
-12
No files found.
include/linux/skbuff.h
View file @
9c4d8938
...
@@ -803,12 +803,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, struct page *p
...
@@ -803,12 +803,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, struct page *p
skb_shinfo
(
skb
)
->
nr_frags
=
i
+
1
;
skb_shinfo
(
skb
)
->
nr_frags
=
i
+
1
;
}
}
#define SKB_PAGE_ASSERT(skb) do { if (skb_shinfo(skb)->nr_frags) \
#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
BUG(); } while (0)
#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
#define SKB_FRAG_ASSERT(skb) do { if (skb_shinfo(skb)->frag_list) \
#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
BUG(); } while (0)
#define SKB_LINEAR_ASSERT(skb) do { if (skb_is_nonlinear(skb)) \
BUG(); } while (0)
/*
/*
* Add data to an sk_buff
* Add data to an sk_buff
...
@@ -837,7 +834,7 @@ static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
...
@@ -837,7 +834,7 @@ static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
SKB_LINEAR_ASSERT
(
skb
);
SKB_LINEAR_ASSERT
(
skb
);
skb
->
tail
+=
len
;
skb
->
tail
+=
len
;
skb
->
len
+=
len
;
skb
->
len
+=
len
;
if
(
skb
->
tail
>
skb
->
end
)
if
(
unlikely
(
skb
->
tail
>
skb
->
end
)
)
skb_over_panic
(
skb
,
len
,
current_text_addr
());
skb_over_panic
(
skb
,
len
,
current_text_addr
());
return
tmp
;
return
tmp
;
}
}
...
@@ -862,7 +859,7 @@ static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
...
@@ -862,7 +859,7 @@ static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
{
{
skb
->
data
-=
len
;
skb
->
data
-=
len
;
skb
->
len
+=
len
;
skb
->
len
+=
len
;
if
(
skb
->
data
<
skb
->
head
)
if
(
unlikely
(
skb
->
data
<
skb
->
head
)
)
skb_under_panic
(
skb
,
len
,
current_text_addr
());
skb_under_panic
(
skb
,
len
,
current_text_addr
());
return
skb
->
data
;
return
skb
->
data
;
}
}
...
@@ -870,8 +867,7 @@ static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
...
@@ -870,8 +867,7 @@ static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
static
inline
char
*
__skb_pull
(
struct
sk_buff
*
skb
,
unsigned
int
len
)
static
inline
char
*
__skb_pull
(
struct
sk_buff
*
skb
,
unsigned
int
len
)
{
{
skb
->
len
-=
len
;
skb
->
len
-=
len
;
if
(
skb
->
len
<
skb
->
data_len
)
BUG_ON
(
skb
->
len
<
skb
->
data_len
);
BUG
();
return
skb
->
data
+=
len
;
return
skb
->
data
+=
len
;
}
}
...
@@ -1137,8 +1133,7 @@ static inline int __deprecated skb_linearize(struct sk_buff *skb, int gfp)
...
@@ -1137,8 +1133,7 @@ static inline int __deprecated skb_linearize(struct sk_buff *skb, int gfp)
static
inline
void
*
kmap_skb_frag
(
const
skb_frag_t
*
frag
)
static
inline
void
*
kmap_skb_frag
(
const
skb_frag_t
*
frag
)
{
{
#ifdef CONFIG_HIGHMEM
#ifdef CONFIG_HIGHMEM
if
(
in_irq
())
BUG_ON
(
in_irq
());
BUG
();
local_bh_disable
();
local_bh_disable
();
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment