Commit Graph
40 Commits
Author SHA1 Message Date
Cong Ding 75f0aef622 uio: fix memory leak
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 <[email protected]>
Acked-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-10-29 16:36:54 -07:00
Cong Ding c4afd7b95f avr32: boards/atngw100/mrmt.c: fix building error
there is an additional "{", which causes building error.

Signed-off-by: Cong Ding <[email protected]>
Acked-by: Hans-Christian Egtvedt <[email protected]>
2013-08-08 14:16:22 +02:00
Cong Ding bc4ba94ce7 RDMA/cxgb3: Fix uninitialized variable
The variable npages might be used uninitialized.

Signed-off-by: Cong Ding <[email protected]>
Acked-by: Steve Wise <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
2013-04-16 22:45:33 -07:00
Cong Ding 7414d4f64b drivers/block/swim3.c: fix null pointer dereference
The use of pointer fs should be after the null check.

Signed-off-by: Cong Ding <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
2013-02-22 10:42:46 +01:00
Cong Ding b5d8f05204 drm/nouveau: remove unnecessary null pointer check from nouveau_fence_new
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 <[email protected]>
Signed-off-by: Marcin Slusarz <[email protected]>
Signed-off-by: Ben Skeggs <[email protected]>
2013-02-20 16:00:37 +10:00
Cong Ding 32ac1a5286 staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage
There is a memory leakage in variable sg if it goes to error.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Rob Clark <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-02-16 17:38:05 -05:00
Cong Ding e68b1130df dma: of-dma.c: fix memory leakage
The memory allocated to ofdma might be a leakage when error occurs.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
2013-02-14 19:11:46 +05:30
Cong Ding 4880f56438 [media] stv0900: remove unnecessary null pointer check
The address of a variable is impossible to be null, so we remove the check.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Michael Krufky <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2013-02-08 18:05:48 -02:00
Cong Ding e48caab206 net: wireless/rtlwifi: fix uninitialized variable issue
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 <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
2013-02-08 14:51:31 -05:00
Cong Ding 9887dbf5b2 mac80211: fix error in sizeof() usage
Using 'sizeof' on array given as function argument returns
size of a pointer rather than the size of array.

Cc: [email protected]
Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
2013-02-06 17:31:55 +01:00
Cong Ding 0e79537d30 ext4: reduce one "if" comparison in ext4_dirhash()
It is unnecessary to check i<4 after the loop; just do it before the
break.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
2013-02-01 22:33:21 -05:00
Cong Ding fefd9e6f88 powerpc: kernel/kgdb.c: Fix memory leakage
the variable backup_current_thread_info isn't freed before existing the
function.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-01-29 10:18:15 +11:00
Cong Ding 813f13e7d6 ARM: S3C24XX: fix uninitialized variable warning
the use of variable tmp is uninitialized, so we fix it.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Kukjin Kim <[email protected]>
2013-01-28 14:27:49 -08:00
Cong Ding 0af125ca06 iommu/omap: Remove unnecessary null pointer check
The pointer obj is dereferenced in line 146 and 149 respectively, so it is not
necessary to check null again in line 149 and 175. And I have checked that all
the callers of these two functions guarantee the parameter obj passed is not
null.

Signed-off-by: Cong Ding <[email protected]>
Acked-by: Ohad Ben-Cohen <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
2013-01-28 15:21:27 +01:00
Cong Ding 65315d4889 x86/boot: Fix minor fd leakage in tools/relocs.c
The opened file should be closed.

Signed-off-by: Cong Ding <[email protected]>
Cc: Kusanagi Kouichi <[email protected]>
Cc: Jarkko Sakkinen <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Matt Fleming <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
2013-01-27 10:24:28 -08:00
Cong Ding 1ec3911dbd libceph: fix undefined behavior when using snprintf()
The variable "str" is used as both the source and destination in
function snprintf(), which is undefined behavior based on C11. The
original description in C11 is:
	"If copying takes place between objects that
	overlap, the behavior is undefined."

And, the function of ceph_osdmap_state_str() is to return the osdmap
state, so it should return "doesn't exist" when all the conditions
are not satisfied. I fix it in this patch.

[[email protected]: shortened the commit message]

Signed-off-by: Cong Ding <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
2013-01-25 17:48:59 -06:00
Cong Ding b9975dabe3 x86/apb/timer: Remove unnecessary "if"
adev has no chance to be NULL, so we don't need to check it. It
is also dereferenced just before the check .

Signed-off-by: Cong Ding <[email protected]>
Cc: Sasha Levin <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
2013-01-24 13:03:26 +01:00
Cong Ding 10b8c7dff5 fs/cifs/cifs_dfs_ref.c: fix potential memory leakage
When it goes to error through line 144, the memory allocated to *devname is
not freed, and the caller doesn't free it either in line 250. So we free the
memroy of *devname in function cifs_compose_mount_options() when it goes to
error.

Signed-off-by: Cong Ding <[email protected]>
CC: stable <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
2013-01-22 23:58:16 -06:00
Cong Ding d6f620a457 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 Ding <[email protected]>
Acked-by: Jason Cooper <[email protected]>
Acked-by: Gregory CLEMENT <[email protected]>
Acked-by: Mike Turquette <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
2013-01-23 01:06:52 +00:00
Cong Ding eee569e403 net: wireless/rtlwifi: fix uninitialized variable issue
The use of variable packet_beacon might be uninitialized in the three files.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
2013-01-22 16:01:30 -05:00
Cong Ding 04cef49e84 sparc: kernel/sbus.c: fix memory leakage
The variable iommu and strbuf are not freed properly if it goes to error.

Signed-off-by: Cong Ding <[email protected]>
Reviewed-by: Richard Mortimer <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
2013-01-21 14:33:00 -08:00
Cong Ding 855372c013 dma: sh/shdma-base.c: remove unnecessary null pointer check
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 <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
2013-01-20 05:49:40 -08:00
Cong Ding ed30933e6f dma: remove unnecessary null pointer check in mmp_pdma.c
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 <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
2013-01-20 05:49:40 -08:00
Cong Ding f938f3781f tty: serial/crisv10.c: remove unnecessary null pointer check
The pointer tty is dereferened in line 3135, so it is not necessary to check
null again in line 3140.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-17 17:20:10 -08:00
Cong Ding 9ef20d52e0 tty: serial/68328serial.c: remove unnecessary null pointer check
The pointer info is dereferened in line 1009, so it is not necessary to check
null again in line 1012.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-17 17:20:09 -08:00
Cong Ding cce17b457b staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage
There is a memory leakage in variable sg if it goes to error.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Rob Clark <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-17 13:19:55 -08:00
Cong Ding a046b816a4 KVM: s390: kvm/sigp.c: fix memory leakage
the variable inti should be freed in the branch CPUSTAT_STOPPED.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
Signed-off-by: Gleb Natapov <[email protected]>
2013-01-17 08:41:48 +02:00
Cong Ding 3d2d032476 MIPS: vpe.c: Fix null pointer dereference in print arguments.
In the printk, the variable t euqals to NULL, so there is no t->index.
Use v->tc->index instead.

[[email protected]: Use opportunity of changing this line anyway to make
this line whitespacely correct.]

Signed-off-by: Cong Ding <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/4792/
Signed-off-by: Ralf Baechle <[email protected]>
2013-01-16 16:29:23 +01:00
Cong Ding 37c44b52b1 tty: add parenthesis to macro POLL_PERIOD in rocket.c
Macros should be enclosed in parenthesis

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-15 22:49:36 -08:00
Cong Ding b9f8033f28 tty: cleanup checkpatch warning in pty.c
spaces are used for indent in 3 places of tty/pty.c, we change it to tab.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-15 22:49:36 -08:00
Cong Ding 82f8c35f86 tty: cleanup the panic message
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-15 22:49:36 -08:00
Cong Ding 92b336f6af tty: vt/Makefile: set the variables to static
tty: vt/Makefile: set the variables to static

In the file drivers/tty/vt/defkeymap.c generated by command
loadkeys --mktable defkeymap.map > defkeymap.c
the 6 variables: shift_map, altgr_map, ctrl_map, shift_ctrl_map, alt_map,
and ctrl_alt_map should be static because they are used only in this file.
There is no reason to remove the static by sed command.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-15 21:52:24 -08:00
Cong Ding 0902468846 staging: echo.c: fix memory leakage
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-07 14:03:32 -08:00
Cong Ding c020a7a4ea staging: echo: remove unused variable
the variable j isn't used in the loop

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-01-07 14:03:31 -08:00
Cong Ding bd7790286b ipv6: addrconf.c: remove unnecessary "if"
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
2012-12-19 12:50:06 -08:00
Cong Ding 37028758f9 fs/ecryptfs/crypto.c: make ecryptfs_encode_for_filename() static
the function ecryptfs_encode_for_filename() is only used in this file

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: Tyler Hicks <[email protected]>
2012-12-18 10:10:13 -06:00
Cong Ding 918854a65e lib/rbtree_test.c: fix uninitialized variable warning
Fix this warning:

  lib/rbtree_test.c: In function `check':
  lib/rbtree_test.c:121: warning: `blacks' may be used uninitialized in this function

Signed-off-by: Cong Ding <[email protected]>
Cc: Michel Lespinasse <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2012-12-17 17:15:18 -08:00
Cong Ding 6cdd6400b2 ssb: use WARN in main.c
Use WARN rather than printk followed by WARN_ON(1), for conciseness.

Signed-off-by: Cong Ding <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
2012-12-10 15:47:32 -05:00
Cong Ding 28a7938922 x86: Fix the error of using "const" in gen-insn-attr-x86.awk
The original version code causes following sparse warnings:
arch/x86/lib/inat-tables.c:1080:25: warning: duplicate const
arch/x86/lib/inat-tables.c:1095:25: warning: duplicate const
arch/x86/lib/inat-tables.c:1118:25: warning: duplicate const

for the variables inat_escape_tables, inat_group_tables, and inat_avx_tables
in the code generated by gen-insn-attr-x86.awk.

The author Masami Hiramutsu says here is to make both the value pointed by the
pointers and the pointers itself read-only, so we move the "const" to be after
the "*".

Signed-off-by: Cong Ding <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
2012-12-10 10:31:24 -08:00
Cong Ding 4a7d6455b0 tools:virtio: fix compilation warning
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 <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
2012-12-06 17:09:17 +02:00