Commit f05de73b authored by Jean Sacren's avatar Jean Sacren Committed by David S. Miller

skbuff: create skb_panic() function and its wrappers

Create skb_panic() function in lieu of both skb_over_panic() and
skb_under_panic() so that code duplication would be avoided. Update type
and variable name where necessary.

Jiri Pirko suggested using wrappers so that we would be able to keep the
fruits of the original code.
Signed-off-by: default avatarJean Sacren <sakiwit@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e307c67
...@@ -104,47 +104,37 @@ static const struct pipe_buf_operations sock_pipe_buf_ops = { ...@@ -104,47 +104,37 @@ static const struct pipe_buf_operations sock_pipe_buf_ops = {
.get = sock_pipe_buf_get, .get = sock_pipe_buf_get,
}; };
/*
* Keep out-of-line to prevent kernel bloat.
* __builtin_return_address is not used because it is not always
* reliable.
*/
/** /**
* skb_over_panic - private function * skb_panic - private function for out-of-line support
* @skb: buffer * @skb: buffer
* @sz: size * @sz: size
* @here: address * @addr: address
* * @panic: skb_over_panic or skb_under_panic
* Out of line support code for skb_put(). Not user callable. *
* Out-of-line support for skb_put() and skb_push().
* Called via the wrapper skb_over_panic() or skb_under_panic().
* Keep out of line to prevent kernel bloat.
* __builtin_return_address is not used because it is not always reliable.
*/ */
static void skb_over_panic(struct sk_buff *skb, int sz, void *here) static void skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
const char panic[])
{ {
pr_emerg("%s: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx dev:%s\n", pr_emerg("%s: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx dev:%s\n",
__func__, here, skb->len, sz, skb->head, skb->data, panic, addr, skb->len, sz, skb->head, skb->data,
(unsigned long)skb->tail, (unsigned long)skb->end, (unsigned long)skb->tail, (unsigned long)skb->end,
skb->dev ? skb->dev->name : "<NULL>"); skb->dev ? skb->dev->name : "<NULL>");
BUG(); BUG();
} }
/** static void skb_over_panic(struct sk_buff *skb, unsigned int sz, void *addr)
* skb_under_panic - private function
* @skb: buffer
* @sz: size
* @here: address
*
* Out of line support code for skb_push(). Not user callable.
*/
static void skb_under_panic(struct sk_buff *skb, int sz, void *here)
{ {
pr_emerg("%s: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx dev:%s\n", skb_panic(skb, sz, addr, __func__);
__func__, here, skb->len, sz, skb->head, skb->data,
(unsigned long)skb->tail, (unsigned long)skb->end,
skb->dev ? skb->dev->name : "<NULL>");
BUG();
} }
static void skb_under_panic(struct sk_buff *skb, unsigned int sz, void *addr)
{
skb_panic(skb, sz, addr, __func__);
}
/* /*
* kmalloc_reserve is a wrapper around kmalloc_node_track_caller that tells * kmalloc_reserve is a wrapper around kmalloc_node_track_caller that tells
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment