1. 28 8月, 2010 1 次提交
    • J
      net/ipv4: Eliminate kstrdup memory leak · c34186ed
      Julia Lawall 提交于
      The string clone is only used as a temporary copy of the argument val
      within the while loop, and so it should be freed before leaving the
      function.  The call to strsep, however, modifies clone, so a pointer to the
      front of the string is kept in saved_clone, to make it possible to free it.
      
      The sematic match that finds this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @r exists@
      local idexpression x;
      expression E;
      identifier l;
      statement S;
      @@
      
      *x= \(kasprintf\|kstrdup\)(...);
      ...
      if (x == NULL) S
      ... when != kfree(x)
          when != E = x
      if (...) {
        <... when != kfree(x)
      * goto l;
        ...>
      * return ...;
      }
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c34186ed
  2. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  3. 14 8月, 2009 1 次提交
  4. 02 3月, 2009 1 次提交
  5. 17 10月, 2008 1 次提交
  6. 29 4月, 2008 2 次提交
  7. 29 1月, 2008 2 次提交
    • I
      [TCP]: Uninline tcp_is_cwnd_limited · cea14e0e
      Ilpo Järvinen 提交于
      net/ipv4/tcp_cong.c:
        tcp_reno_cong_avoid |  -65
       1 function changed, 65 bytes removed, diff: -65
      
      net/ipv4/arp.c:
        arp_ignore |   -5
       1 function changed, 5 bytes removed, diff: -5
      
      net/ipv4/tcp_bic.c:
        bictcp_cong_avoid |  -57
       1 function changed, 57 bytes removed, diff: -57
      
      net/ipv4/tcp_cubic.c:
        bictcp_cong_avoid |  -61
       1 function changed, 61 bytes removed, diff: -61
      
      net/ipv4/tcp_highspeed.c:
        hstcp_cong_avoid |  -63
       1 function changed, 63 bytes removed, diff: -63
      
      net/ipv4/tcp_hybla.c:
        hybla_cong_avoid |  -85
       1 function changed, 85 bytes removed, diff: -85
      
      net/ipv4/tcp_htcp.c:
        htcp_cong_avoid |  -57
       1 function changed, 57 bytes removed, diff: -57
      
      net/ipv4/tcp_veno.c:
        tcp_veno_cong_avoid |  -52
       1 function changed, 52 bytes removed, diff: -52
      
      net/ipv4/tcp_scalable.c:
        tcp_scalable_cong_avoid |  -61
       1 function changed, 61 bytes removed, diff: -61
      
      net/ipv4/tcp_yeah.c:
        tcp_yeah_cong_avoid |  -75
       1 function changed, 75 bytes removed, diff: -75
      
      net/ipv4/tcp_illinois.c:
        tcp_illinois_cong_avoid |  -54
       1 function changed, 54 bytes removed, diff: -54
      
      net/dccp/ccids/ccid3.c:
        ccid3_update_send_interval |   -7
        ccid3_hc_tx_packet_recv    |   +7
       2 functions changed, 7 bytes added, 7 bytes removed, diff: +0
      
      net/ipv4/tcp_cong.c:
        tcp_is_cwnd_limited |  +88
       1 function changed, 88 bytes added, diff: +88
      
      built-in.o:
       14 functions changed, 95 bytes added, 642 bytes removed, diff: -547
      
      ...Again some gcc artifacts visible as well.
      Signed-off-by: NIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cea14e0e
    • I
  8. 18 7月, 2007 1 次提交
  9. 18 5月, 2007 1 次提交
  10. 26 4月, 2007 2 次提交
  11. 24 4月, 2007 1 次提交
  12. 18 2月, 2007 1 次提交
  13. 11 2月, 2007 1 次提交
  14. 03 12月, 2006 3 次提交
  15. 02 11月, 2006 1 次提交
  16. 25 9月, 2006 1 次提交
  17. 30 8月, 2006 1 次提交
  18. 01 7月, 2006 1 次提交
  19. 18 6月, 2006 1 次提交
  20. 29 3月, 2006 1 次提交
  21. 04 1月, 2006 1 次提交
    • S
      [TCP]: less inline's · 40efc6fa
      Stephen Hemminger 提交于
      TCP inline usage cleanup:
       * get rid of inline in several places
       * replace __inline__ with inline where possible
       * move functions used in one file out of tcp.h
       * let compiler decide on used once cases
      
      On x86_64: 
         text	   data	    bss	    dec	    hex	filename
      3594701	 648348	 567400	4810449	 4966d1	vmlinux.orig
      3593133	 648580	 567400	4809113	 496199	vmlinux
      
      On sparc64:
         text	   data	    bss	    dec	    hex	filename
      2538278	 406152	 530392	3474822	 350586	vmlinux.ORIG
      2536382	 406384	 530392	3473158	 34ff06	vmlinux
      Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      40efc6fa
  22. 11 11月, 2005 3 次提交
  23. 30 8月, 2005 1 次提交
    • A
      [ICSK]: Move TCP congestion avoidance members to icsk · 6687e988
      Arnaldo Carvalho de Melo 提交于
      This changeset basically moves tcp_sk()->{ca_ops,ca_state,etc} to inet_csk(),
      minimal renaming/moving done in this changeset to ease review.
      
      Most of it is just changes of struct tcp_sock * to struct sock * parameters.
      
      With this we move to a state closer to two interesting goals:
      
      1. Generalisation of net/ipv4/tcp_diag.c, becoming inet_diag.c, being used
         for any INET transport protocol that has struct inet_hashinfo and are
         derived from struct inet_connection_sock. Keeps the userspace API, that will
         just not display DCCP sockets, while newer versions of tools can support
         DCCP.
      
      2. INET generic transport pluggable Congestion Avoidance infrastructure, using
         the current TCP CA infrastructure with DCCP.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6687e988
  24. 24 6月, 2005 2 次提交