lkml.org 
[lkml]   [2005]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectShouldn't we be using alloc_skb/kfree_skb in net/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl ?
    I was just grep'ing through the source looking for places where skb's 
    might be freed by plain kfree() and, amongst other things, I noticed
    net/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl, where a struct sk_buff*
    is defined and then storage for it is allocated with kmalloc() and freed
    with kfree(), and I'm wondering if we shouldn't be using
    alloc_skb/kfree_skb instead (as pr the patch below)? Or is there some good
    reason for doing it the way it's currently done?


    Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
    ---

    net/ipv4/netfilter/ipt_recent.c | 4 ++--
    1 files changed, 2 insertions(+), 2 deletions(-)

    --- linux-2.6.12-rc6-mm1-orig/net/ipv4/netfilter/ipt_recent.c 2005-06-12 15:58:58.000000000 +0200
    +++ linux-2.6.12-rc6-mm1/net/ipv4/netfilter/ipt_recent.c 2005-06-16 23:41:55.000000000 +0200
    @@ -303,7 +303,7 @@ static int ip_recent_ctrl(struct file *f
    strncpy(info->name,curr_table->name,IPT_RECENT_NAME_LEN);
    info->name[IPT_RECENT_NAME_LEN-1] = '\0';

    - skb = kmalloc(sizeof(struct sk_buff),GFP_KERNEL);
    + skb = alloc_skb(sizeof(struct sk_buff),GFP_KERNEL);
    if (!skb) {
    used = -ENOMEM;
    goto out_free_info;
    @@ -322,7 +322,7 @@ static int ip_recent_ctrl(struct file *f

    kfree(skb->nh.iph);
    out_free_skb:
    - kfree(skb);
    + kfree_skb(skb);
    out_free_info:
    kfree(info);


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-06-17 00:33    [W:0.034 / U:94.804 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site