[PATCH 1/1] orinoco: fix improper return value

2016-12-07 Thread Pan Bian
bug.cgi?id=188671 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/net/wireless/intersil/orinoco/wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/orinoco/wext.c b/drivers/net/wireless/intersil/orinoco/wext.c index 1d4dae4

[PATCH 1/1] net: usb: set error code when usb_alloc_urb fails

2016-12-03 Thread Pan Bian
o ret when usb_alloc_urb() returns a NULL pointer. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188771 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/net/usb/lan78xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx

[PATCH 1/1] net: wireless: intersil: fix improper return value

2016-12-03 Thread Pan Bian
bug.cgi?id=188671 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/net/wireless/intersil/orinoco/wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/orinoco/wext.c b/drivers/net/wireless/intersil/orinoco/wext.c index 1d4dae4

[PATCH 1/1] btrfs: volumes: fix improper return value

2016-12-03 Thread Pan Bian
Variable ret takes the errno on failures. However, it directly returns 0. It may be better to return "ret". Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188741 Signed-off-by: Pan Bian <bianpan2...@163.com> --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertio

[PATCH 1/1] scsi: csiostor: fix improper return value

2016-12-03 Thread Pan Bian
gi?id=188681 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/scsi/csiostor/csio_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index 622bdab..8970df2 100644 --- a/drivers/scsi/csiostor/cs

[PATCH 1/1] xen: xenbus: set error code on failure

2016-12-03 Thread Pan Bian
kernel.org/show_bug.cgi?id=188721 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/xen/xenbus/xenbus_probe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 33a31cf..f87d047 100644 --- a/dr

[PATCH 1/1] net: caif: fix ineffective error check

2016-12-03 Thread Pan Bian
In function caif_sktinit_module(), the check of the return value of sock_register() seems ineffective. This patch fixes it. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751 Signed-off-by: Pan Bian <bianpan2...@163.com> --- net/caif/caif_socket.c | 2 +- 1 file changed, 1 ins

[PATCH 1/1] net: bridge: set error code on failure

2016-12-03 Thread Pan Bian
Function br_sysfs_addbr() does not set error code when the call kobject_create_and_add() returns a NULL pointer. It may be better to return "-ENOMEM" when kobject_create_and_add() fails. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781 Signed-off-by: Pan Bian <bianpa

[PATCH 1/1] misc: set error code when devm_kstrdup fails

2016-12-03 Thread Pan Bian
lla: https://bugzilla.kernel.org/show_bug.cgi?id=188651 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/misc/sram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index f84b53d..0ef7d65 100644 --- a/drivers/misc/sram

[PATCH 1/1] netdev: broadcom: propagate error code

2016-12-03 Thread Pan Bian
Function bnxt_hwrm_stat_ctx_alloc() always returns 0, even if the call to _hwrm_send_message() fails. It may be better to propagate the errors to the caller of bnxt_hwrm_stat_ctx_alloc(). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188661 Signed-off-by: Pan Bian <bianpan2...@163.

[PATCH 1/1] net: wireless: intersil: fix improper return value

2016-12-03 Thread Pan Bian
bug.cgi?id=188671 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/net/wireless/intersil/orinoco/wext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/orinoco/wext.c b/drivers/net/wireless/intersil/orinoco/wext.c index 1d4dae4

[PATCH 1/1] net: wireless: marvell: fix improper return value

2016-12-03 Thread Pan Bian
stack memory to user sapce, resulting in stack information leak. To avoid the bug, this patch returns variable ret (which takes the return value of lbs_cmd_with_response()) instead of 0. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188451 Signed-off-by: Pan Bian <bianpan2...@163.

[PATCH 1/1] dri: vc4: set error code on failure

2016-12-03 Thread Pan Bian
kernel.org/show_bug.cgi?id=188631 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/gpu/drm/vc4/vc4_gem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 47a095f..2592a94 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +

[PATCH 1/1] tty: serial: set error code when kasprintf fails

2016-12-03 Thread Pan Bian
assigns "-ENOMEM" to the return variable ret. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188691 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/tty/serial/sh-sci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci

[PATCH 1/1] btrfs: fix improper return value

2016-12-03 Thread Pan Bian
In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret on errors. However, it directly returns 0. It may be better to return ret. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731 Signed-off-by: Pan Bian <bianpan2...@163.com> --- fs/btrfs/uuid-tree.c | 2 +-

[PATCH 1/1] extcon: return error code on failure

2016-12-03 Thread Pan Bian
-ENOMEM. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/extcon/extcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 7829846..7c1e3a7

[PATCH 1/1] iio: light: fix improper return value

2016-12-03 Thread Pan Bian
. This patch fixes the bug. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188641 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/iio/light/cm3232.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index f

[PATCH 1/1] scsi: 32-9xxx: fix improper return value on errors

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function twa_probe(), returns the value of variable retval on error paths. However, on some error paths, retval is not set to negative errnos, and its value will keep 0. This patch fixes them. Signed-off-by: Pan Bian <bianpan2...@163.com> ---

Re: [PATCH 1/1] net: caif: fix ineffective error check

2016-12-03 Thread Pan Bian
From: PanBian <bianpan2...@163.com> Hello Sergei, On Sat, Dec 03, 2016 at 04:17:51PM +0300, Sergei Shtylyov wrote: > Hello. > > On 12/3/2016 2:18 PM, Pan Bian wrote: > > >In function caif_sktinit_module(), the check of the return value of > >sock_register() seems

[PATCH 1/1] atm: lanai: set error code when ioremap fails

2016-12-03 Thread Pan Bian
?id=188791 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/atm/lanai.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index ce43ae3..445505d 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c @@ -2143,6 +2143,7 @@ static in

[PATCH 1/1] infiniband: hw: cxgb4: set errno on failure

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function c4iw_rdev_open(), the value of return variable err should be negative on errors. However, when the call to __get_free_page() returns a NULL pointer, its value is not set to "-ENOMEM" and keeps 0. 0 means no error. And thus, the

[PATCH 1/1] scsi: csiostor: fix improper reference to variable

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function csio_config_device_caps(), returns the value of variable rv on error paths. However, when validating device capabilities, its value is reset, and will be 0 on the following error paths. 0 means no error in this context. It may be better

[PATCH 1/1] crypto: asymmetric_keys: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function public_key_verify_signature(), returns variable ret on error paths. When the call to kmalloc() fails, the value of ret is 0, and it is not set to an errno before returning. This patch fixes the bug. Bugzilla: https://bugzilla.kern

[PATCH 1/1] net: ethernet: 3com: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function typhoon_init_one(), returns the value of variable err on errors. However, on some error paths, variable err is not set to a negative errno. This patch assigns "-EIO" to err on those paths. Signed-off-by: Pan Bian <bianpan2...@16

[PATCH 1/1] net: dcb: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function dcbnl_cee_fill(), returns the value of variable err on errors. However, on some error paths (e.g. nla put fails), its value may be 0. It may be better to explicitly set a negative errno to variable err before returning. Bugzilla:

[PATCH 1/1] staging: iio: cdc: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> At the end of function ad7150_write_event_config(), directly returns 0. As a result, the errors will be ignored by the callers. It may be better to return variable "ret". Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/stagin

[PATCH 1/1] cpuidle: fix improper return value on error

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function cpuidle_add_state_sysfs(), variable ret takes the return value. Its value should be negative on errors. Because ret is reset in the loop, its value will be 0 during the second and after repeat of the loop. If kzalloc() returns a NULL p

Re: [PATCH 1/1] net: ethernet: 3com: set error code on failures

2016-12-03 Thread Pan Bian
e view of callers of typhoon_init_one(). Thanks! Best regards, Pan On Sat, Dec 03, 2016 at 02:53:07PM +0100, Lino Sanfilippo wrote: > Hi, > > On 03.12.2016 14:24, Pan Bian wrote: > > From: Pan Bian <bianpan2...@163.com> > > > > In function typhoon_init_one(), returns

[PATCH 1/1] media: platform: sti: return -ENOMEM on errors

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function bdisp_debugfs_create() returns 0 even on errors. So its caller cannot detect the errors. It may be better to return "-ENOMEM" on the exception paths. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188801 Signed-off-by: Pa

[PATCH 1/1] staging: lustre: lnet: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> At the end of function lstcon_group_info(), "return 0" seems improper. It may be better to return the value of rc. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188811 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drive

[PATCH 1/1] infiniband: hw: ocrdma: fix bad initialization

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function ocrdma_mbx_create_ah_tbl(), returns the value of status on errors. However, because status is initialized with 0, 0 will be returned even if on error paths. This patch initialize status with "-ENOMEM". Bugzilla: https://bug

[PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable

2016-12-03 Thread Pan Bian
"-ENOMEM" when kmalloc() fails. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188911 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/gpu/drm/qxl/qxl_release.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b

[PATCH 1/1] net: caif: remove ineffective check

2016-12-03 Thread Pan Bian
lla: https://bugzilla.kernel.org/show_bug.cgi?id=188751 Signed-off-by: Pan Bian <bianpan2...@163.com> --- net/caif/caif_socket.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index aa209b1..92cbbd2 100644 --- a/net/caif/caif_socket.

[PATCH 1/1] btrfs: fix improper return value

2016-12-03 Thread Pan Bian
-off-by: Pan Bian <bianpan2...@163.com> --- fs/btrfs/uuid-tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index 7fc89e4..83bb2f2 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -351,7 +351,5

[PATCH 1/1] isdn: hisax: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function hfc4s8s_probe(), the value of return variable err should be negative on failures. However, when the call to request_region() returns NULL, the value of err is 0. This patch fixes the bug, assiging "-ENOMEM" to err on the path tha

[PATCH 2/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Variable ret is reset in the loop, and its value will be 0 during the second and after repeat of the loop. If pci_alloc_consistent() returns a NULL pointer then, it will leaves with return value 0. 0 means no error, which is contrary to the fact. This p

[PATCH 1/1] atm: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> It returns variable "error" when ioremap_nocache() returns a NULL pointer. The value of "error" is 0 then, which will mislead the callers to believe that there is no error. This patch fixes the bug, returning "-ENOMEM". B

[PATCH 1/1] scsi: fnic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When the calls to mempool_create_slab_pool() return unexpected values, the value of return variable err is 0. 0 means no error. Thus, the caller of fnic_probe() cannot detect the error, and may be misled. This patch fixes the bug, assigning "-ENO

[PATCH 1/1] scsi: snic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When the calls to mempool_create_slab_pool() return unexpected values, the value of return variable ret is 0. 0 means no error. Thus, the caller of fnic_probe() cannot detect the error, and may be misled. This patch fixes the bug, assigning "-ENO

[PATCH 1/1] net: ethernet: qlogic: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When calling dma_mapping_error(), the value of return variable rc is 0. And when the call returns an unexpected value, rc is not set to a negative errno. Thus, it will return 0 on the error path, and its callers cannot detect the bug. This patch fixes t

[PATCH 1/1] edac: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When the call to zalloc_cpumask_var() fails, returning "false" seems improper. The real value of macro "false" is 0, and 0 means no error. This patch fixes the bug, returning "-ENOMEM". Bugzilla: https://bugzilla.kernel.or

[PATCH 1/1] net: ethernet: qlogic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When the call to qlcnic_alloc_mbx_args() fails, returning variable "err" seems improper. With reference to the context, returing variable "config" may be better. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189101 Signed-

[PATCH 1/1] mtd: ubi: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When __vmalloc() returns a NULL pointer, the region is not checked, and we cannot make sure that only 0xFF bytes are present at offset. Thus, returning 0 seems improper. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189081 Signed-off-by: Pa

[PATCH 1/1] xen: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> The return variable rc is initialized with "-ENOMEM" outside the loop. However, it is reset in the loop, and its value is not negative during the second or after repeat of the loop. If kzalloc() fails then, it will return 0. This pat

[PATCH 1/1] input: usbhid: fix improper check

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function hid_post_reset() returns 0 on success, or 1 on failures. However, in function hid_reset_resume(), uses "status >= 0" to check the return value of hid_post_reset(). Obviously, the condition will always be satisfied. This patch

[PATCH 1/1] net: irda: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When the calls to kzalloc() fail, the value of return variable ret may be 0. 0 means success in this context. This patch fixes the bug, assigning "-ENOMEM" to ret before calling kzalloc(). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?i

[PATCH 1/1] memstick: host: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When pci_ioremap_bar() returns a NULL pointer, the value of return variable "error" is 0. 0 means no error, which is contrary to the fact. Similarly, the return values are also improper when request_irq() or memstick_add_host() returns u

[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> The value of return variable ret is 0 on some error paths, for example, when pci_resource_start() returns a NULL pointer. 0 means no error in this context, which is contrary to the fact. This patch fixes the bug. Bugzilla: https://bugzilla.kern

[PATCH 1/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Variable ret is reset in the loop, and its value will be 0 during the second and after repeat of the loop. If pci_alloc_consistent() returns a NULL pointer then, it will leaves with return value 0. 0 means no error, which is contrary to the fact. This p

[PATCH 1/1] scsi: 3w-sas: set errno on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> On some error paths (e.g. pci_iomap() returns a NULL pointer), the value of return variable retval is 0. 0 means no error. This patch fixes the bug, set retval with negative errno on error paths. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=

[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> The value of return variable ret is 0 on some error paths, for example, when pci_resource_start() returns a NULL pointer. 0 means no error in this context, which is contrary to the fact. This patch fixes the bug. Bugzilla: https://bugzilla.kern

[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> If uhw->inlen is non-zero, the value of variable err is 0 if the copy succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it will return 0 to the callers. As a result, the callers cannot detect the errors. This patch fixes the bug,

[PATCH 1/1] net: ethernet: broadcom: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Marco BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate memory, and jumps to label "lbl" if the allocation fails. Label "lbl" first cleans memory and then returns variable rc. Before calling the macro, the value of v

[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> If uhw->inlen is non-zero, the value of variable err is 0 if the copy succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it will return 0 to the callers. As a result, the callers cannot detect the errors. This patch fixes the bu

[PATCH 1/1] net: bnx2x: fix improper return value

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Marco BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate memory, and jumps to label "lbl" if the allocation fails. Label "lbl" first cleans memory and then returns variable rc. Before calling the macro, the value of v

[PATCH 1/1] usb: return error code when platform_get_irq fails

2016-11-29 Thread Pan Bian
xhci_mtk_probe() will not be able to detect the error. This patch fixes the bug by assigning the return value of platform_get_irq() to variable ret if it fails. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/usb/host/xhci-mtk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH 1/1] usb: abort on exception path

2016-11-29 Thread Pan Bian
n the call to usb_control_msg() fails. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/usb/serial/kl5kusb105.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index fc5d3a7..068919f 100644 --- a/drivers/usb/serial/kl5kusb105

[PATCH 1/1] usb: return correct errno on failures

2016-11-29 Thread Pan Bian
() or usb_alloc_urb() fails in the loop, the value of variable result may be 0 (indicates no error), which is inconsistent with the execution status. This patch fixes the bug, initializing variable result with -ENOMEM in the loop. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/usb/wusbc

[PATCH 1/1] usb: fix improper return value when kzalloc fails

2016-11-29 Thread Pan Bian
tch fixes the bug, returning -ENOMEM when the call to kzalloc() fails. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/usb/wusbcore/wa-nep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c index ed46222..e3819

[PATCH 1/1] usb: return correct errno code when krealloc fails

2016-11-29 Thread Pan Bian
igned when krealloc() returns a NULL pointer. As a result, a positive value may be returned, which makes it impossible for the caller of wusb_dev_sec_add() to detect the error. This patch fixes the bug by assigning -ENOMEM to result when krealloc() returns NULL. Signed-off-by: Pan Bian <bianpa

[PATCH 1/1] isdn: hisax: set error code on failure

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function hfc4s8s_probe(), the value of return variable err should be negative on failures. However, when the call to request_region() returns NULL, the value of err is 0. This patch fixes the bug, assiging "-EBUSY" to err on the path tha

[PATCH 1/1] net: bnx2x: fix improper return value

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Macro BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate memory, and jumps to label "lbl" if the allocation fails. Label "lbl" first cleans memory and then returns variable rc. Before calling the macro, the value of v

[PATCH 1/1 v2] isdn: hisax: set error code on failure

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function hfc4s8s_probe(), the value of return variable err should be negative on failures. However, when the call to request_region() returns NULL, the value of err is 0. This patch fixes the bug, assigning "-EBUSY" to err on the path tha

[PATCH 1/1 v2] net: bnx2x: fix improper return value

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Macro BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate memory, and jumps to label "lbl" if the allocation fails. Label "lbl" first cleans memory and then returns variable rc. Before calling the macro, the value of v

[PATCH 1/1] net: qed: set error code on failure

2016-12-04 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> When calling dma_mapping_error(), the value of return variable rc is 0. And when the call returns an unexpected value, rc is not set to a negative errno. Thus, it will return 0 on the error path, and its callers cannot detect the bug. This patch fixes t

[PATCH 1/1 v2] input: usbhid: fix improper return value

2016-12-05 Thread Pan Bian
Function hid_post_reset() should return negative error codes on failures. However, in its implementation, it incorrectly returns 1. This patch fixes the bug, returning proper error codes on failures. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/hid/usbhid/hid-core.c | 6 +++

[PATCH 1/2 v2] mtd: ubi: fix improper return value

2016-12-04 Thread Pan Bian
When __vmalloc() returns a NULL pointer, the region is not really checked, and we cannot conclude that only 0xFF bytes are present at offset. Thus, returing 0 seems improper. This patches fixes it, returns "-ENOMEM" and removes the warning. Signed-off-by: Pan Bian <bianpa

[PATCH 2/2] mtd: ubi: fix improper return value

2016-12-04 Thread Pan Bian
When __vmalloc() returns a NULL pointer, the data is not really tested, and we cannot conclude that the data matches. Thus, returning 0 seems improper. This patch fixes it, returns "-ENOMEM" and removes the warning. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/

[PATCH 1/1 v2] xen: set error code on failures

2016-12-05 Thread Pan Bian
alloc_page() returns NULL, and removing the initialization of rc outside of the loop. v1 is reviewed by: Juergen Gross <jgr...@suse.com> Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/xen/gntalloc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) di

[PATCH 1/1 v2] xen: xenbus: set error code on failure

2016-12-05 Thread Pan Bian
Variable err is initialized with 0. As a result, the return value may be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes the bug, initializing err with "-ENOMEM". v1 is reviewed by: Juergen Gross <jgr...@suse.com> Signed-off-by: Pan Bian <bianpan2...@16

[PATCH 2/2 v2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Pan Bian
. This patch fixes the bug, assigning "-ENOMEM" to ret on the path that the call to pci_alloc_consistent() fails. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188951 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3

[PATCH 1/2 v2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Pan Bian
. This patch fixes the bug, assigning "-ENOMEM" to ret on the path that the call to pci_alloc_consistent() fails. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188941 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3

Re: [PATCH 1/1] xen: xenbus: set error code on failure

2016-12-04 Thread Pan Bian
From: PanBian <bianpan2...@163.com> On Mon, Dec 05, 2016 at 07:30:49AM +0100, Juergen Gross wrote: > On 03/12/16 11:49, Pan Bian wrote: > > In function xenstored_local_init(), the value of return variable err > > should be negative on errors. But the value of err keeps 0

[PATCH 1/1] block: nbd: fix bugs in nbd_init

2016-11-30 Thread Pan Bian
error code on the branch that blk_mq_init_queue() returns an invalid pointer. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/block/nbd.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7a10487..200e899

[PATCH 1/1] block: rsxx: set error code on exception path

2016-11-30 Thread Pan Bian
by assigning -ENOMEM to st when the call fails. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/block/rsxx/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 34997df..925bc46 100644 --- a/drivers/block/rsxx/core.c

[PATCH 1/1] block: mtip32xx: set error code on failure

2016-11-30 Thread Pan Bian
indicates that there is no error, which may be inconsistent with the execution status. This patch fixes the bug by explicitly assigning -ENOMEM to rv on the branch that ida_pre_get() fails. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/block/mtip32xx/mtip32xx.c | 4 +++- 1 file c

[PATCH 1/1] crypto: set error code when kcalloc fails

2016-11-30 Thread Pan Bian
) even if kcalloc() fails. This patch fixes the bug by explicitly assigning -ENOMEM to err when kcalloc() returns a NULL pointer. Signed-off-by: Pan Bian <bianpan2...@163.com> --- crypto/algif_skcipher.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/algif_skciph

[PATCH 1/1] clk: clk-wm831x: fix a logic error

2016-11-30 Thread Pan Bian
Fix bug https://bugzilla.kernel.org/show_bug.cgi?id=188561. Function wm831x_clkout_is_prepared() returns "true" when it fails to read CLOCK_CONTROL_1. "true" means the device is already prepared. So return "true" on the read failure seems improper. Signed-off-by:

[PATCH 2/2] dma: ioat: fix improper return value on failures

2016-11-30 Thread Pan Bian
Fix bug https://bugzilla.kernel.org/show_bug.cgi?id=188601. This patch is based on "0001-dma-ioat-set-error-code-on-failures.patch". In this patch, assign error code -ENOMEM to return variable err as long as the call to dma_mapping_error() fails. Signed-off-by: Pan Bian <bianpa

[PATCH 1/1] bluetooth: propagate the error code

2016-11-30 Thread Pan Bian
() may not detect the submission error. In this patch, use "return err;" at the end to propagate the error. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/bluetooth/bpa10x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/bpa10x.c b/d

[PATCH 1/1] dma: ioat: set error code on failures

2016-11-30 Thread Pan Bian
the bug by assigning -ENOMEM to err on the error path. Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/dma/ioat/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index 015f711..32383ef 100644 --- a/drivers/dma/ioat/init.c

[PATCH 1/2] dmaengine: ioat: set error code on failures

2016-12-02 Thread Pan Bian
. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188591 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/dma/ioat/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index 015f711..32383ef 100644 --- a/drivers/dma/ioat/init.c

[PATCH 2/2] dmaengine: ioat: set error code on failures

2016-12-02 Thread Pan Bian
error path. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188601 Signed-off-by: Pan Bian <bianpan2...@163.com> --- drivers/dma/ioat/init.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index

[PATCH 1/1] net: bcmgenet: fix incorrect return value checks

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function platform_get_irq() will return a negative value on errors. However, in function bcmgenet_probe(), 0 is considered as a flag of error. This patch fixes the bug by checking whether the return value of platform_get_irq() is less than 0. Sign

[PATCH 1/1] rtc: gemini: add return value validation

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function devm_ioremap() will return a NULL pointer if it fails to remap IO address, and its return value should be validated before it is used. However, in function gemini_rtc_probe(), its return value is not checked. This may result in bad memory acces

[PATCH 1/1] drm/radeon: check return value of radeon_ring_lock

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function radeon_ring_lock() returns an errno on failure, and its return value should be validated. However, in functions r420_cp_errata_init() and r420_cp_errata_fini(), its return value is not checked. This patch adds the checks. Signed-off-by: Pa

[PATCH 1/1] qlcnic: fix unchecked return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function pci_find_ext_capability() may return 0, which is an invalid address. In function qlcnic_sriov_virtid_fn(), its return value is used without validation. This may result in invalid memory access bugs. This patch fixes the bug. Signed-off-by: Pa

[PATCH 1/1] libertas: check return value of alloc_workqueue

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function alloc_workqueue() will return a NULL pointer if there is no enough memory, and its return value should be validated before using. However, in function if_spi_probe(), its return value is not checked. This may result in a NULL dereferen

[PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function radeon_fence_emit() returns -ENOMEM if there is no enough memory. And in this case, function radeon_ring_unlock_undo() rather than function radeon_ring_unlock_commit() should be called. However, in function radeon_test_create_and_emit

[PATCH 1/1] iommu/amd: fix incorrect error handling

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function amd_iommu_bind_pasid(), the control flow jumps to label out_free when pasid_state->mm and mm is NULL. And mmput(mm) is called. In function mmput(mm), mm is referenced without validation. This will result in a NULL dereference bug. This pa

[PATCH 1/1] m5602_s5k83a: check return value of kthread_create

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function kthread_create() returns an ERR_PTR on error. However, in function s5k83a_start(), its return value is used without validation. This may result in a bad memory access bug. This patch fixes the bug. Signed-off-by: Pan Bian <bianpan2..

[PATCH 1/1] staging: comedi: addi_apci_3xxx: check return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function pci_ioremap_bar() will return a NULL pointer if there is no enough memory. However, in function apci3xxx_auto_attach(), the return value of function pci_ioremap_bar() is not validated. This may result in NULL dereference in following access

[PATCH 1/1] char: xillybus: check return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function of_address_to_resource() tries to translate device tree address and return as resource. If the translation fails, it will return a negative errno. However, function xilly_drv_probe() does not validate its return value, which may result in a bad

[PATCH 1/1] usb: hub: check return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function usb_autopm_get_interface() will return a negative errno on failure, and function usb_autopm_put_interface() should not be called if it fails. However, in function usb_remove_device(), the return value of function usb_autopm_get_int

[PATCH 1/1] [media] cx25840: fix unchecked return values

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In functions cx25840_initialize(), cx231xx_initialize(), and cx23885_initialize(), the return value of create_singlethread_workqueue() is used without validation. This may result in NULL dereference and cause kernel crash. This patch fixes it. Sign

[PATCH 1/1] PCI: check return value of pci_find_ext_capability

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function pci_find_ext_capability() will returns 0 on failure, and its return value should be checked before it is used. However, in function pcie_port_enable_msix(), its return value is not checked. This patch adds the check. Signed-off-by: Pan Bian <

[PATCH 1/1] staging: wilc1000: fix unchecked return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function dev_alloc_skb() will return a NULL pointer if there is no enough memory. However, in function WILC_WFI_mon_xmit(), its return value is used without validation. This may result in a bad memory access bug. This patch fixes the bug. Signed-off-b

[PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> unction devm_regmap_init_i2c() returns an ERR_PTR on errors, and its return value should be checked before it is dereferenced. However, in function intel_soc_pmic_i2c_probe(), the return value of function devm_regmap_init_i2c() is used without vali

[PATCH 1/1] wan: pc300too: abort path on failure

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> In function pc300_pci_init_one(), on the ioremap error path, function pc300_pci_remove_one() is called to free the allocated memory. However, the path is not terminated, and the freed memory will be used later, resulting in use-after-free bugs. This path

[PATCH 1/1] [media] cobalt: fix unchecked return values

2017-04-23 Thread Pan Bian
From: Pan Bian <bianpan2...@163.com> Function pci_find_ext_capability() may return 0, which is an invalid address. In function cobalt_pcie_status_show(), its return value is used without validation. This patch adds checks to validate the return address. Signed-off-by: Pan Bian <bianpa

  1   2   >