[PATCH] avr32: boards/atngw100/mrmt.c: fix building error

2013-07-27 Thread Cong Ding
there is an additional "{", which causes building error. Signed-off-by: Cong Ding --- arch/avr32/boards/atngw100/mrmt.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c index ccc9599..1ba09e4 100644 --- a/

Re: [PATCH v2 1/1] uio.c: solve memory leak

2013-07-25 Thread Cong Ding
On Mon, May 27, 2013 at 12:14 AM, Cong Ding wrote: > On Thu, Apr 25, 2013 at 12:19 PM, Cong Ding wrote: >> On Thu, Feb 14, 2013 at 12:43:15PM +0100, Cong Ding wrote: >>> On Sun, Jan 20, 2013 at 10:01:41PM +0100, Hans J. Koch wrote: >>> > On Fri, Jan 18, 2013 a

[PATCH] net: wireless/rtlwifi: fix uninitialized variable issue

2013-02-04 Thread Cong Ding
The use of variable packet_beacon might be uninitialized in the two files, which is same as this patch: https://patchwork.kernel.org/patch/2006711/ Signed-off-by: Cong Ding --- drivers/net/wireless/rtlwifi/rtl8192ce/trx.c |2 +- drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |2 +- 2

[PATCH] infiniband: hw/cxgb3/iwch_provider.c: fix uninitialized variable issue

2013-02-04 Thread Cong Ding
The variable npages might be used uninitialized in line 594. Signed-off-by: Cong Ding --- drivers/infiniband/hw/cxgb3/iwch_provider.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c

Re: [PATCH] i2c: busses/i2c-pxa.c: fix potential null pointer dereference error

2013-02-04 Thread Cong Ding
On Tue, Feb 05, 2013 at 08:47:10AM +0900, Kyungmin Park wrote: > Hi, > > On Tue, Feb 5, 2013 at 7:11 AM, Cong Ding wrote: > > If it goes to eclk through line 1107, the variable res would be NULL. It > > will > > cause a null pointer dereference error if

[PATCH v2] i2c: busses/i2c-pxa.c: fix potential null pointer dereference error

2013-02-04 Thread Cong Ding
If it goes to eclk through line 1107, the variable res would be NULL. It will cause a null pointer dereference error if we call release_mem_region. Signed-off-by: Cong Ding --- drivers/i2c/busses/i2c-pxa.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c

Re: [PATCH v2] i2c: busses/i2c-pxa.c: fix potential null pointer dereference error

2013-02-05 Thread Cong Ding
On Tue, Feb 05, 2013 at 09:14:08AM +0800, Haojian Zhuang wrote: > On Tue, Feb 5, 2013 at 8:05 AM, Cong Ding wrote: > > If it goes to eclk through line 1107, the variable res would be NULL. It > > will > > cause a null pointer dereference error if we call release_mem_regio

[PATCH] net: mac80211/cfg.c: fix error using of sizeof()

2013-02-06 Thread Cong Ding
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array. Signed-off-by: Cong Ding --- net/mac80211/cfg.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 661b878..af561d5

[PATCH] uio: fix memory leak

2013-10-25 Thread Cong Ding
we have to call kobject_put() to clean up the kobject after function kobject_init(), kobject_add(), or kobject_uevent() is called. Signed-off-by: Cong Ding --- drivers/uio/uio.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/uio/uio.c b/drivers

[PATCH] fs/9p: fix flags in the format of printf

2013-10-26 Thread Cong Ding
To print "int" value, we should use %d rather than %u. Signed-off-by: Cong Ding --- fs/9p/vfs_inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index af7d531..dcc099a 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/v

[PATCH] btrfs: fix memory leakage

2013-10-27 Thread Cong Ding
The memory allocated to "name" by function "extref_get_fields" isn't properly freed when error occurs. Signed-off-by: Cong Ding --- fs/btrfs/tree-log.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c in

Re: [PATCH v2 1/1] uio.c: solve memory leak

2013-05-26 Thread Cong Ding
On Thu, Apr 25, 2013 at 12:19 PM, Cong Ding wrote: > On Thu, Feb 14, 2013 at 12:43:15PM +0100, Cong Ding wrote: >> On Sun, Jan 20, 2013 at 10:01:41PM +0100, Hans J. Koch wrote: >> > On Fri, Jan 18, 2013 at 02:00:50PM -0800, Greg Kroah-Hartman wrote: >> > > On Fri, Ja

Re: [PATCH v2 1/1] uio.c: solve memory leak

2013-04-25 Thread Cong Ding
On Thu, Feb 14, 2013 at 12:43:15PM +0100, Cong Ding wrote: > On Sun, Jan 20, 2013 at 10:01:41PM +0100, Hans J. Koch wrote: > > On Fri, Jan 18, 2013 at 02:00:50PM -0800, Greg Kroah-Hartman wrote: > > > On Fri, Jan 18, 2013 at 10:05:45PM +0100, Cong Ding wrote: > > > >

Re: [PATCH] uio.c: Fix warning: 'ret' might be used uninitialized

2012-11-29 Thread Cong Ding
No, there are some exceptions. Imagine this case, when mi=0, everything works correct in the loop, and then mi=1, if the kzalloc in line 286 fails, you patch will goto err_map with ret=-ENOMEM, while Hans's patch will goto err_map with ret=0 (the ret=0 is from line 295 when mi=0). On Thu, Nov 29,

[PATCH 1/1] kbuild: solve the DSO link change issue

2012-11-29 Thread Cong Ding
: Invalid operation collect2: ld returned 1 exit status due to the DSO link change, we must explicitly link against every library needed. http://fedoraproject.org/wiki/UnderstandingDSOLinkChange Signed-off-by: Cong Ding --- scripts/kconfig/Makefile |1 + 1 files changed, 1 insertions(+), 0

[PATCH v2 1/1] uio.c: solve memory leak

2012-11-29 Thread Cong Ding
In version 1, I forgot to modify the same bug in the first loop. we have to call kobject_put() to clean up the kobject after function kobject_init(), kobject_add(), or kobject_uevent() is called. Signed-off-by: Cong Ding --- drivers/uio/uio.c | 16 ++-- 1 files changed, 10

Re: [PATCH v2 1/1] uio.c: solve memory leak

2012-11-30 Thread Cong Ding
Hi Hans, I think the memory allocated with kzalloc is properly freed by calling kobject_put. I can give a simple explanation. 1) when we call kobject_init, the parameter portio_attr_type is passed in. portio_attr_type includes a function pointer to portio_release, which releases the memory of

Re: [PATCH] uio.c: Fix warning: 'ret' might be used uninitialized

2012-11-30 Thread Cong Ding
On Fri, Nov 30, 2012 at 10:33 PM, Hans J. Koch wrote: > On Fri, Nov 30, 2012 at 12:12:46PM +0100, Tux9 wrote: >> I like Vitalii's solution more. Hans's solution assign the value >> -ENOMEM to ret in every round of the loop, which is a kind of wasting >> CPU cycles. > > The difference between > 1

Re: [PATCH] uio.c: Fix warning: 'ret' might be used uninitialized

2012-12-01 Thread Cong Ding
On Sat, Dec 01, 2012 at 04:56:25AM +0100, Hans J. Koch wrote: > On Sat, Dec 01, 2012 at 02:22:44AM +0100, Cong Ding wrote: > > On Fri, Nov 30, 2012 at 10:33 PM, Hans J. Koch wrote: > > > On Fri, Nov 30, 2012 at 12:12:46PM +0100, Tux9 wrote: > > >> I like Vitalii's

[PATCH] fs:ext4:hash.c: reduce one "if" comparison

2012-12-01 Thread Cong Ding
it is unnecessary to check i<4 after the loop. just do it before the break. Signed-off-by: Cong Ding --- fs/ext4/hash.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c index fa8e491..3d586f0 100644 --- a/fs/ext4/hash.c +++ b/fs/e

[PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks

2012-12-01 Thread Cong Ding
it's not necessary to lock the buffers because no one touches them beyond the file system. Signed-off-by: Cong Ding --- fs/ext3/resize.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 0f814f3..f76fcd6 100644 --- a/fs/ext3

[PATCH] scsi:gdth.c: fix compilation warning

2012-12-03 Thread Cong Ding
We do not allow old-style function definition. Always spell foo(void) if a function does not take any parameters. Signed-off-by: Cong Ding --- drivers/scsi/gdth.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 5d72274

[PATCH] tools:virtio: fix compilation warning

2012-12-03 Thread Cong Ding
We do not allow old-style function definition. Always spell foo(void) if a function does not take any parameters. Signed-off-by: Cong Ding --- tools/virtio/virtio_test.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virtio/virtio_test.c b/tools/virtio

[PATCH] drivers:staging: fix compilation warning

2012-12-03 Thread Cong Ding
We do not allow old-style function definition. Always spell foo(void) if a function does not take any parameters. Signed-off-by: Cong Ding --- drivers/staging/telephony/ixj.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/telephony/ixj.c b/drivers

Re: [PATCH] drivers:staging: fix compilation warning

2012-12-03 Thread Cong Ding
On Mon, Dec 03, 2012 at 01:56:09PM +0300, Dan Carpenter wrote: > On Mon, Dec 03, 2012 at 10:34:08AM +0000, Cong Ding wrote: > > We do not allow old-style function definition. Always spell foo(void) if > > a function does not take any parameters. > > > > You should be

[PATCH] staging: echo: remove unused variable

2012-12-03 Thread Cong Ding
the variable j isn't used in the loop Signed-off-by: Cong Ding --- drivers/staging/echo/echo.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/staging/echo/echo.c b/drivers/staging/echo/echo.c index ca87ce9..14dfd91 100644 --- a/drivers/staging/echo/echo.c

Re: [PATCH] memory: of_memory.c: remove unnecessary initialization

2012-12-05 Thread Cong Ding
"main2.c" .text .p2align 4,,15 .globl foo [ding@GNU ~]$ > On Tue, Dec 4, 2012 at 10:46 PM, Santosh Shilimkar > wrote: > > On Tuesday 04 December 2012 07:25 PM, Grant Likely wrote: > >> > >> On Tue, Dec 4, 2012 at 11:44 AM, Santosh Shil

[PATCH] sched: fix compilation warning

2012-12-05 Thread Cong Ding
/sched/debug.c:225:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat] where function atomic64_read returns long long int, but %ld was used in the printf Signed-off-by: Cong Ding --- kernel/sched/debug.c |2 +- 1 files changed, 1

[PATCH RFC -next] Fix the trailing blank space issue

2012-12-06 Thread Cong Ding
116e Mon Sep 17 00:00:00 2001 From: Cong Ding Date: Thu, 6 Dec 2012 15:58:15 +0100 Subject: [PATCH RFC -next] remove all the trailing blank space clean all the trailing blank space by using shell command $ find . -iname '*.[ch]' | xargs sed 's/\s\+$//g' -i I have manually checked a random set of a

Re: [PATCH RFC -next] Fix the trailing blank space issue

2012-12-06 Thread Cong Ding
On Thu, Dec 06, 2012 at 08:06:06AM -0800, Greg Kroah-Hartman wrote: > On Thu, Dec 06, 2012 at 03:42:20PM +0000, Cong Ding wrote: > > On Thu, Dec 06, 2012 at 05:08:56PM +0800, Bin Wang wrote: > > > This patch removes the trailing white space in fs/sysfs/mount.c. > > > &g

[PATCH] gpu: drm/nouveau/core/engine/disp/dacnv50.c: fix var uninit issue

2012-12-06 Thread Cong Ding
the variable "ret" might be uninitialized in the "default" branch of "switch" Signed-off-by: Cong Ding --- drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/en

Re: [PATCH v2 1/1] uio.c: solve memory leak

2012-12-06 Thread Cong Ding
ping Hans, did you have any comment on this? - cong On Fri, Nov 30, 2012 at 12:03 PM, Cong Ding wrote: > Hi Hans, I think the memory allocated with kzalloc is properly freed > by calling kobject_put. > > I can give a simple explanation. > > 1) when we call kobject_i

[PATCH] fix initializer entry defined twice issue

2012-12-06 Thread Cong Ding
the ".config_intr" is defined twice in both line 208 and 212. Signed-off-by: Cong Ding --- drivers/net/phy/smsc.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 16dceed..5cee6bd 100644 --- a/drivers/net/

Re: [PATCH] fix initializer entry defined twice issue

2012-12-06 Thread Cong Ding
On Thu, Dec 06, 2012 at 05:59:21PM -0600, Patrick Trantham wrote: > On 12/06/2012 05:16 PM, Cong Ding wrote: > >the ".config_intr" is defined twice in both line 208 and 212. > > > >Signed-off-by: Cong Ding > >--- > > drivers/net/phy/smsc.c |1

[PATCH] net: core: fix unused variable sparse warning

2012-12-06 Thread Cong Ding
the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is defined, otherwise it causes the following sparse warning when we turn on CONFIG_SYSCTL. Signed-off-by: Cong Ding --- net/core/neighbour.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/net/core

Re: [PATCH] net: core: fix unused variable sparse warning

2012-12-06 Thread Cong Ding
On Fri, Dec 07, 2012 at 12:06:44AM +, Cong Ding wrote: > the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is > defined, otherwise it causes the following sparse warning when we turn on > CONFIG_SYSCTL. sorry for disturbing again, the sparse warning is net/core/ne

[PATCH] fs/ecryptfs/crypto.c: make ecryptfs_encode_for_filename() static

2012-12-07 Thread Cong Ding
the function ecryptfs_encode_for_filename() is only used in this file Signed-off-by: Cong Ding --- fs/ecryptfs/crypto.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index ea99312..a7b0c2d 100644 --- a/fs/ecryptfs/crypto.c

Re: [PATCH] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const

2012-12-07 Thread Cong Ding
On Fri, Dec 07, 2012 at 02:45:43PM -0800, H. Peter Anvin wrote: > Patch description please? there are 2 consts in the definition of one variable - cong > > Cong Ding wrote: > > > > >Signed-off-by: Cong Ding > >--- > > arch/x86/tools/gen-insn-attr-x86.aw

Re: [PATCH] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const

2012-12-07 Thread Cong Ding
On Fri, Dec 07, 2012 at 02:56:16PM -0800, H. Peter Anvin wrote: > On 12/07/2012 02:49 PM, Cong Ding wrote: > >On Fri, Dec 07, 2012 at 02:45:43PM -0800, H. Peter Anvin wrote: > >>Patch description please? > >there are 2 consts in the definition of one variable > > >

[PATCH v2] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const

2012-12-07 Thread Cong Ding
On Fri, Dec 07, 2012 at 03:06:13PM -0800, H. Peter Anvin wrote: > On 12/07/2012 03:03 PM, Cong Ding wrote: > >On Fri, Dec 07, 2012 at 02:56:16PM -0800, H. Peter Anvin wrote: > >>On 12/07/2012 02:49 PM, Cong Ding wrote: > >>>On Fri, Dec 07, 2012 at 02:45:43

Re: [PATCH v2 1/1] uio.c: solve memory leak

2012-12-07 Thread Cong Ding
On Sat, Dec 08, 2012 at 01:10:40AM +0100, Hans J. Koch wrote: > On Fri, Dec 07, 2012 at 12:02:11AM +0100, Cong Ding wrote: > > ping Hans, did you have any comment on this? > > Sounds right what you say. Is your patch v2 your final solution, or would > you like to come up wi

[PATCH] tty: vt/Makefile: set the variables to static

2012-12-07 Thread Cong Ding
nly in this file. There is no reason to remove the static by sed command. Signed-off-by: Cong Ding --- drivers/tty/vt/Makefile |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile index 14a51c9..17ae94c 100644 --- a/drivers/tty

[PATCH 1/2] tty: remove trailing spaces in tty/hvc

2012-12-07 Thread Cong Ding
remove trailing blank spaces in tty/hvc by shell command: sed 's/\s\+$//g' -i I have manually reviewed that everything is correct. Signed-off-by: Cong Ding --- drivers/tty/hvc/hvc_console.c |6 +++--- drivers/tty/hvc/hvc_xen.c |2 +- drivers/tty/hvc/hvcs.c|4 ++-- 3

[PATCH 2/2] tty: remove trailing spaces in tty/vt

2012-12-07 Thread Cong Ding
remove trailing blank spaces in tty/vt by shell command: sed 's/\s\+$//g' -i I have manually reviewed that everything is correct. Signed-off-by: Cong Ding --- drivers/tty/vt/consolemap.c | 62 +- drivers/tty/vt/keyboard.c |4 +- drivers/tty/vt

[PATCH] ssb: use WARN in main.c

2012-12-08 Thread Cong Ding
Use WARN rather than printk followed by WARN_ON(1), for conciseness. Signed-off-by: Cong Ding --- drivers/ssb/main.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index bd7115c..c82c5c9 100644 --- a/drivers/ssb/main.c +++ b

[PATCH v3] x86: fix the error of using "const" in gen-insn-attr-x86.awk

2012-12-09 Thread Cong Ding
>From 9523e1de9d2771dc66a5b645651fc9f4745eb685 Mon Sep 17 00:00:00 2001 From: Cong Ding Date: Sun, 9 Dec 2012 08:06:20 + Subject: [PATCH v3] x86: fix the error of using "const" in gen-insn-attr-x86.awk x86: fix the error of using "const" in gen-insn-attr-x86.awk Th

Re: [PATCH v2] arch/x86/tools/gen-insn-attr-x86.awk: remove duplicate const

2012-12-09 Thread Cong Ding
On Sun, Dec 09, 2012 at 02:24:55PM +0900, Masami Hiramatsu wrote: > (2012/12/08 8:17), Cong Ding wrote: > >>>>>> Patch description please? > >>>>> there are 2 consts in the definition of one variable > >>>>> > >>>>

Re: [PATCH 1/1] kbuild: solve the DSO link change issue

2012-12-09 Thread Cong Ding
Ping Michal, did you have any comments on this? - cong On Thu, Nov 29, 2012 at 05:21:28PM +, Cong Ding wrote: > when make menuconfig, it reports this error: > > /usr/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to > symbol 'acs_map' > /usr/bin/ld:

Re: [PATCH] scsi:gdth.c: fix compilation warning

2012-12-09 Thread Cong Ding
ping! - cong On Mon, Dec 03, 2012 at 10:19:09AM +, Cong Ding wrote: > We do not allow old-style function definition. Always spell foo(void) if > a function does not take any parameters. > > Signed-off-by: Cong Ding > --- > drivers/scsi/gdth.c |2 +- > 1 files

Re: [PATCH] staging: echo: remove unused variable

2012-12-09 Thread Cong Ding
ping! - cong On Tue, Dec 04, 2012 at 01:21:44AM +, Cong Ding wrote: > the variable j isn't used in the loop > > Signed-off-by: Cong Ding > --- > drivers/staging/echo/echo.c |3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/drive

[PATCH] lib/rbtree_test.c: fix uninitialized variable warning

2012-12-11 Thread Cong Ding
this patch is to fix the following compilation warning: lib/rbtree_test.c: In function ‘check’: lib/rbtree_test.c:121: warning: ‘blacks’ may be used uninitialized in this function the use of variable blacks in line 133 might be uninitialized Signed-off-by: Cong Ding --- lib/rbtree_test.c

[PATCH] w1:masters/w1-gpio.c: fix error using "__devinit" and "__devexit"

2012-12-11 Thread Cong Ding
notate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console Signed-off-by: Cong Ding --- drivers/w1/masters/w1-gpio.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dr

Re: null dereference at r100_debugfs_cp_ring_info+0x115/0x140

2012-12-11 Thread Cong Ding
On Tue, Dec 11, 2012 at 10:07:06AM -0500, Dave Jones wrote: > (Taint comes from previous r600 bug reported here > https://lkml.org/lkml/2012/12/8/131) > > [35662.070628] BUG: unable to handle kernel NULL pointer dereference at > (null) > [35662.071719] IP: []

Re: [PATCH] btrfs: fix potential null pointer dereference bug

2013-01-24 Thread Cong Ding
On Thu, Jan 24, 2013 at 10:34:20AM -0500, Josef Bacik wrote: > On Sat, Jan 19, 2013 at 08:27:45AM -0700, Cong Ding wrote: > > The bug happens when rb_node == NULL. It causes variable node to be NULL and > > then the NULL pointer is dereferenced this line: > > BUG_ON((str

[PATCH resend] sched: fix compilation warning

2013-01-27 Thread Cong Ding
/sched/debug.c:225:2: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat] where function atomic64_read returns long long int, but %ld was used in the printf Signed-off-by: Cong Ding --- resend because no reply for Message-Id: <1354727440-20

Re: [PATCH] drivers/uio/uio_pdrv_genirq.c: Fix memory leak & confusing labels

2012-11-27 Thread Cong Ding
On Wed, Nov 28, 2012 at 12:07 AM, Hans J. Koch wrote: > On Tue, Nov 27, 2012 at 07:29:32PM +0200, Vitalii Demianets wrote: >> Memory leak was caused by jumping to the wrong exit label. So, it is good >> time >> to improve misleading label names too. > > I agree that bad0, bad1, and bad2 are not

Re: [PATCH] drivers/uio/uio_pdrv_genirq.c: Fix memory leak & confusing labels

2012-11-28 Thread Cong Ding
On Wed, Nov 28, 2012 at 1:37 AM, Hans J. Koch wrote: > On Wed, Nov 28, 2012 at 01:07:26AM +0100, Cong Ding wrote: >> On Wed, Nov 28, 2012 at 12:07 AM, Hans J. Koch wrote: >> > On Tue, Nov 27, 2012 at 07:29:32PM +0200, Vitalii Demianets wrote: >> >> Memory leak was

[PATCH 1/1] solve memory leak for uio

2012-11-28 Thread Cong Ding
we have to call kobject_put() to clean up the kobject after function kobject_init(), kobject_add(), or kobject_uevent() is called. Signed-off-by: Cong Ding --- drivers/uio/uio.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/uio/uio.c b/drivers/uio

[PATCH] usr/gen_init_cpio.c: remove unnecessary "if"

2012-12-18 Thread Cong Ding
usr/gen_init_cpio.c: remove unnecessary "if" if it goes to fail, dname isn't allocated; otherwise, it is allocated successfully. so we just free memory when it doesn't fail. this patch also fix a trival trailing space warning by checkpatch Signed-off-by: Cong Ding --- usr/gen_i

[PATCH] ipv6: addrconf.c: remove unnecessary "if"

2012-12-18 Thread Cong Ding
the value of err is always negative if it goes to errout, so we don't need to check the value of err. Signed-off-by: Cong Ding --- net/ipv6/addrconf.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6fca01f..408cac4a

Re: [PATCH] usr/gen_init_cpio.c: remove unnecessary "if"

2012-12-18 Thread Cong Ding
On Tue, Dec 18, 2012 at 02:03:08PM -0800, Kees Cook wrote: > [resend, busted mailer] > > On Tue, Dec 18, 2012 at 1:26 PM, Cong Ding wrote: > > > > usr/gen_init_cpio.c: remove unnecessary "if" > > > > if it goes to fail, dname isn't allocated; otherwi

Re: [PATCH] usr/gen_init_cpio.c: remove unnecessary "if"

2012-12-18 Thread Cong Ding
On Tue, Dec 18, 2012 at 11:41:53PM +0100, Cong Ding wrote: > On Tue, Dec 18, 2012 at 02:03:08PM -0800, Kees Cook wrote: > > [resend, busted mailer] > > > > On Tue, Dec 18, 2012 at 1:26 PM, Cong Ding wrote: > > > > > > usr/gen_init_cpio.c: remove unnecess

[PATCH] staging: iio: cleanup ring_sw.c

2012-12-18 Thread Cong Ding
clean the checkpatch warnings in ring_sw.c. mostly are 80 characters per line issue. Signed-off-by: Cong Ding --- drivers/staging/iio/ring_sw.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio

[PATCH] staging: echo.c: fix memory leakage

2012-12-22 Thread Cong Ding
we should check the return value of calling function fir16_create(): a NULL value means the memory allocation fails. this patch also cleans up the error handling in function function oslec_create() Signed-off-by: Cong Ding --- drivers/staging/echo/echo.c | 39

[PATCH] kernel/wait.c: fix 80 characters issue

2012-12-25 Thread Cong Ding
fix 80 characters issue Signed-off-by: Cong Ding --- kernel/wait.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/wait.c b/kernel/wait.c index 6698e0c..a80a9e4 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -10,7 +10,8 @@ #include #include -void

[PATCH 2/2] tty: cleanup checkpatch warning in pty.c

2013-01-11 Thread Cong Ding
spaces are used for indent in 3 places of tty/pty.c, we change it to tab. Signed-off-by: Cong Ding --- drivers/tty/pty.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 64fcbdb..358a5fe 100644 --- a/drivers/tty/pty.c +++ b

[PATCH 1/2] tty: cleanup the panic message

2013-01-11 Thread Cong Ding
the "\n" in panic message is excess, so we remove it in tty/pty.c as what it is used in other places. Signed-off-by: Cong Ding --- drivers/tty/pty.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index be6a373..64fc

[PATCH] tty: add parenthesis to macro POLL_PERIOD in rocket.c

2013-01-11 Thread Cong Ding
Macros should be enclosed in parenthesis Signed-off-by: Cong Ding --- drivers/tty/rocket.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index e42009a..e434a79 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c

Re: Why is the kfree() argument const?

2013-01-13 Thread Cong Ding
On Sun, Jan 13, 2013 at 9:10 AM, Chen Gang F T wrote: > Hello Antoine: > > after read through the whole reply of Linus Torvalds for it > (the time stamp is "Wed, 16 Jan 2008 10:39:00 -0800 (PST)"). > > at least for me, his reply is correct in details. > > although what you said is also

[PATCH] clk: mvebu/clk-cpu.c: fix memory leakage

2013-01-14 Thread Cong Ding
the variable cpuclk and clk_name should be properly freed. Signed-off-by: Cong Ding --- drivers/clk/mvebu/clk-cpu.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c index ff004578..1a0d84f 100644

[PATCH] block: swim3.c: fix null pointer dereference

2013-01-14 Thread Cong Ding
the use if pointer fs should be after the null check. Signed-off-by: Cong Ding --- drivers/block/swim3.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index d889f95..deb722d 100644 --- a/drivers/block/swim3.c +++ b

[PATCH] mips: kernel/vpe.c: fix wrong KERN_WARNING message

2013-01-14 Thread Cong Ding
in the printk, the variable t euqals to NULL, so there is no t->index, we use v->tc->index instead. Signed-off-by: Cong Ding --- arch/mips/kernel/vpe.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index eec690a

[PATCH] arm: kernel/perf_event_cpu.c: fix error null pointer dereference check

2013-01-14 Thread Cong Ding
the pointer cpu_pmu is used without null pointer dereference check, and is checked after the using of it, so we move the null pointer check to before the first use. Signed-off-by: Cong Ding --- arch/arm/kernel/perf_event_cpu.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions

[PATCH] powerpc: kernel/kgdb.c: fix memory leakage

2013-01-14 Thread Cong Ding
the variable backup_current_thread_info isn't freed before existing the function. Signed-off-by: Cong Ding --- arch/powerpc/kernel/kgdb.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index 8747447..5ca82cd

Re: [PATCH] arm: kernel/perf_event_cpu.c: fix error null pointer dereference check

2013-01-14 Thread Cong Ding
On Mon, Jan 14, 2013 at 05:23:46PM +, Russell King - ARM Linux wrote: > On Mon, Jan 14, 2013 at 05:18:53PM +0000, Cong Ding wrote: > > the pointer cpu_pmu is used without null pointer dereference check, and is > > checked after the using of it, so we move the null pointer

[PATCH v2] arm: kernel/perf_event_cpu.c: remove unnecessary null pointer dereference check

2013-01-14 Thread Cong Ding
The NULL pointer check is not necessary. cpu_pmu_init() is called after cpu_pmu has already been dereferenced by its caller: cpu_pmu = pmu; cpu_pmu->plat_device = pdev; cpu_pmu_init(cpu_pmu); Signed-off-by: Cong Ding --- arch/arm/kernel/perf_event_cpu.c |2 +-

Re: [PATCH] ia64: sn/pci/pcibr/pcibr_reg.c: check null pointer dereference

2013-01-14 Thread Cong Ding
On Mon, Jan 14, 2013 at 11:19:15AM -0700, Bjorn Helgaas wrote: > On Mon, Jan 14, 2013 at 10:53 AM, Cong Ding wrote: > > we should ensure the pointer is not null before the first use, rather than > > after it. > > These changes look technically correct, but the w

[PATCH] atm: fore200e.c: fix uninitialized variable

2013-01-14 Thread Cong Ding
the variable err is uninitialized if all the macros in the function are disabled. Signed-off-by: Cong Ding --- drivers/atm/fore200e.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 204814e..d4725fc 100644

[PATCH v2] ia64: sn/pci/pcibr/pcibr_reg.c: remove unnecessary check null pointer

2013-01-14 Thread Cong Ding
er common->sfdl_pcibus_info is passed. The common->sfdl_pcibus_info is guaranteed to be not null by function pcibr_bus_fixup() in file pcibr_provider.c. The functions pcireg_int_ate_set and pcireg_int_ate_addr are similar as pcireg_int_ate_set. Signed-off-by: Cong Ding --- arch/ia64/sn/pci/pc

[PATCH] arm: mach-zynq/timer.c: fix memory leakage

2013-01-14 Thread Cong Ding
the variable ttccs allocated isn't freed when error occurs, so we call kfree before return. Signed-off-by: Cong Ding --- arch/arm/mach-zynq/timer.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq

[PATCH] sparc: kernel/sbus.c: fix memory leakage

2013-01-14 Thread Cong Ding
the variable iommu and strbuf are not freed if it goes to error. Signed-off-by: Cong Ding --- arch/sparc/kernel/sbus.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c index 1271b3a..0b66e53 100644 --- a/arch

[PATCH] s390: kvm/sigp.c: fix memory leakage

2013-01-14 Thread Cong Ding
the variable inti should be freed in the branch CPUSTAT_STOPPED. Signed-off-by: Cong Ding --- arch/s390/kvm/sigp.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index 461e841..1c48ab2 100644 --- a/arch/s390/kvm/sigp.c +++ b

[PATCH] avr32: boards/atngw100/mrmt.c: fix build error

2013-01-14 Thread Cong Ding
there is an extra "} in the file, so we delete it. Signed-off-by: Cong Ding --- arch/avr32/boards/atngw100/mrmt.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c index f914319..7de083d 100644 --- a/arch/avr32/b

[PATCH] cris: arch-v32/drivers/sync_serial.c: fix error macro position

2013-01-14 Thread Cong Ding
the macro CONFIG_ETRAXFS is used in wrong position - all the port[1] related stuff should be used only when CONFIG_ETRAXFS is enabled. Signed-off-by: Cong Ding --- arch/cris/arch-v32/drivers/sync_serial.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/cris

[PATCH] mpis: cavium-octeon/executive/cvmx-l2c.c: fix uninitialized variable

2013-01-14 Thread Cong Ding
the variable dummy is used without initialization. Signed-off-by: Cong Ding --- arch/mips/cavium-octeon/executive/cvmx-l2c.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/cavium-octeon/executive/cvmx-l2c.c b/arch/mips/cavium-octeon/executive/cvmx-l2c.c index

[PATCH] dma: remove unnecessary null pointer check in mmp_pdma.c

2013-01-14 Thread Cong Ding
the pointer cfg is dereferenced in line 594, so it's no reason to check null again in line 620. Signed-off-by: Cong Ding --- drivers/dma/mmp_pdma.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index c6d98c0..81d7b89

[PATCH] dma: sh/shdma-base.c: remove unnecessary null pointer check

2013-01-14 Thread Cong Ding
the variable chan is dereferenced in line 635, so it is no reason to check null again in line 641. Signed-off-by: Cong Ding --- drivers/dma/sh/shdma-base.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c index f4cd946..4acb85a

[PATCH] gpu: drm/nouveau/nouveau_fence.c: remove unnecessary null pointer check

2013-01-14 Thread Cong Ding
the variable sender is dereferenced in line 190, so it is no reason to check null again in line 198. Signed-off-by: Cong Ding --- drivers/gpu/drm/nouveau/nouveau_fence.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b

Re: [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit.

2013-01-15 Thread Cong Ding
On Mon, Jan 14, 2013 at 08:57:09PM -0800, Eric Dumazet wrote: > On Tue, 2013-01-15 at 12:47 +0800, Harvey Yang wrote: > > The destination address daddr is faddr if source route option is set, > > otherwise it is inet_daddr. So use if-else to assign the value. > > > > Signed-off-by: Harvey Yang

Re: [PATCH] gpu: drm/nouveau/nouveau_fence.c: remove unnecessary null pointer check

2013-01-15 Thread Cong Ding
On Tue, Jan 15, 2013 at 10:39:23AM +, David Howells wrote: > Cong Ding wrote: > > > the variable sender is dereferenced in line 190, so it is no reason to check > > null again in line 198. > > Did you mean "The variable 'chan'"? sorry, my fault. so shou

Re: [PATCH] clk: mvebu/clk-cpu.c: fix memory leakage

2013-01-15 Thread Cong Ding
On Tue, Jan 15, 2013 at 03:13:00PM +0100, Gregory CLEMENT wrote: > Dear Cong Ding, > > On 01/14/2013 06:18 PM, Cong Ding wrote: > > the variable cpuclk and clk_name should be properly freed. > > > > Thanks for reporting this memory leak and for your patch but I thin

[PATCH v2] clk: mvebu/clk-cpu.c: fix memory leakage

2013-01-15 Thread Cong Ding
>From 75c73077905b822be6e8a32a09d6b0cdb5e61763 Mon Sep 17 00:00:00 2001 From: Cong Ding Date: Mon, 14 Jan 2013 18:06:26 +0100 Subject: [PATCH v2] clk: mvebu/clk-cpu.c: fix memory leakage the variable cpuclk and clk_name should be properly freed when error happens. Signed-off-by: Cong D

[PATCH v2] gpu: drm/nouveau/nouveau_fence.c: remove unnecessary null pointer check

2013-01-15 Thread Cong Ding
the variable chan is dereferenced in line 190, so it is no reason to check null again in line 198. Signed-off-by: Cong Ding --- drivers/gpu/drm/nouveau/nouveau_fence.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b

Re: [PATCH v2] clk: mvebu/clk-cpu.c: fix memory leakage

2013-01-15 Thread Cong Ding
On Tue, Jan 15, 2013 at 05:33:57PM +0100, Gregory CLEMENT wrote: > On 01/15/2013 04:37 PM, Jason Cooper wrote: > > Mike, > > > > On Tue, Jan 15, 2013 at 03:23:08PM +, Cong Ding wrote: > >> From 75c73077905b822be6e8a32a09d6b0cdb5e61763 Mon Sep 17 00:00:00 2001 &

[PATCH v3] clk: mvebu/clk-cpu.c: fix memory leakage

2013-01-15 Thread Cong Ding
the variable cpuclk and clk_name should be properly freed when error happens. Signed-off-by: Cong Ding Acked-by: Jason Cooper --- drivers/clk/mvebu/clk-cpu.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk

[PATCH] net: netfilter/xt_CT.c: fix uninitialized variable

2013-01-15 Thread Cong Ding
If CONFIG_NF_CONNTRACK_ZONES is not defined, the variable ret might be uninitialized when it goes to err1 through line 125 and 263 respectively. So I change these goto err1 to return -EINVAL directly. Signed-off-by: Cong Ding --- net/netfilter/xt_CT.c |4 ++-- 1 file changed, 2 insertions

Re: [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable

2013-01-15 Thread Cong Ding
On Tue, Jan 15, 2013 at 07:06:51PM +, Waskiewicz Jr, Peter P wrote: > On Tue, 2013-01-15 at 19:58 +0100, Cong Ding wrote: > > If CONFIG_NF_CONNTRACK_ZONES is not defined, the variable ret might be > > uninitialized when it goes to err1 through line 125 and 263 respectively.

[PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage

2013-01-15 Thread Cong Ding
There is a memory leakage in variable sg if it goes to error. Signed-off-by: Cong Ding --- drivers/staging/omapdrm/omap_gem_dmabuf.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/omapdrm/omap_gem_dmabuf.c b/drivers/staging/omapdrm

[PATCH] media: dvb-frontends/stv0900_core.c: remove unnecessary null pointer check

2013-01-15 Thread Cong Ding
The address of a variable is impossible to be null, so we remove the check. Signed-off-by: Cong Ding --- drivers/media/dvb-frontends/stv0900_core.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb

[PATCH v] media: dvb-frontends: remove unnecessary null pointer check

2013-01-15 Thread Cong Ding
The address of a variable is impossible to be null, so we remove the check. Signed-off-by: Cong Ding --- sorry for sending again. I didn't notice there are another 2 places with the same issue. - cong drivers/media/dvb-frontends/stv0900_core.c | 14 -- drivers/media/dvb

  1   2   3   >