[PATCH] staging: rtl8192e: initializing the wep buffer

2019-10-17 Thread Kangjie Lu
The "wep" buffer is not initialized. To avoid memory disclosures, the fix initializes it, as peer functions like rtllib_ccmp_set_key do. Signed-off-by: Kangjie Lu --- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/stagin

[PATCH] media: rcar_drif: fix a memory disclosure

2019-10-17 Thread Kangjie Lu
"f->fmt.sdr.reserved" is uninitialized. As other peer drivers like msi2500 and airspy do, the fix initializes it to avoid memory disclosures. Signed-off-by: Kangjie Lu --- drivers/media/platform/rcar_drif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platfor

[PATCH] net/lib80211: scrubbing the buffer for key

2019-10-17 Thread Kangjie Lu
The "key" is not scrubbed. As what peer modules do, the fixes zeros out the key buffer. Signed-off-by: Kangjie Lu --- net/wireless/lib80211_crypt_wep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/wireless/lib80211_crypt_wep.c b/net/wireless/lib80211_crypt_wep.c index da

[tip:x86/cleanups] x86/platform/uv: Fix missing checks of kcalloc() return values

2019-03-26 Thread tip-bot for Kangjie Lu
Commit-ID: 766460852cfaeca4042e5f3aeb9616b3689147bc Gitweb: https://git.kernel.org/tip/766460852cfaeca4042e5f3aeb9616b3689147bc Author: Kangjie Lu AuthorDate: Mon, 25 Mar 2019 15:29:22 -0500 Committer: Borislav Petkov CommitDate: Tue, 26 Mar 2019 17:01:30 +0100 x86/platform/uv: Fix

[PATCH v3] PCI: xilinx: Check for __get_free_pages() failure

2019-03-25 Thread Kangjie Lu
If __get_free_pages() fails, the patch returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- v3: remove "unlikely", as suggested by Bjorn Helgaas. v2: caller is redefined to accept the error code, as suggested by Steven Price --- drivers/pci/controller/pci

[PATCH v2] pci: pcie-xilinx: fix a missing-check bug for __get_free_pages

2019-03-25 Thread Kangjie Lu
In case __get_free_pages fail, the fix returns -ENOMEMto avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Reviewed-by: Steven Price --- v2: caller is redefined to accept the error code, as suggested by Steven Price --- drivers/pci/controller/pcie-xilinx.c | 12 ++-- 1 file

[PATCH v2] sound: codecs: fix a potential NULL pointer dereference

2019-03-25 Thread Kangjie Lu
In case devm_kzalloc fails, the patch returns -ENOMEM to avoid potential NULL pointer dereference. Also add a check for rt5663_parse_dp to pass the error code upstream Signed-off-by: Kangjie Lu Reviewed-by: Mukesh Ojha --- v2: pass error code upstream in the caller as suggested by Mukesh Ojha

[PATCH] firmware: arm_scmi: check return value of idr_find

2019-03-25 Thread Kangjie Lu
(). Therefore, the patch conservatively checks the return value and returns -EINVAL when it indeed failed. Signed-off-by: Kangjie Lu Reviewed-by: Steven Price --- drivers/firmware/arm_scmi/driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware/arm_scmi/driver.c b

[PATCH v2] platform: uv: fix missing checks for kcalloc

2019-03-25 Thread Kangjie Lu
In case kcalloc fails, the patch return an error to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- v2: reuse existing error path as suggested by Borislav Petkov --- arch/x86/platform/uv/tlb_uv.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git

[PATCH v2] thunderbolt: property: fix a missing check of kzalloc

2019-03-25 Thread Kangjie Lu
No check is enforced for the return value of kzalloc, which may lead to NULL-pointer dereference. The patch fixes this issue. Signed-off-by: Kangjie Lu Reviewed-by: Mukesh Ojha --- V2: no overflow issue, as pointed out by Mika Westerberg --- drivers/thunderbolt/property.c | 7 ++- 1

[PATCH] sound: codecs: fix a missing check for regmap_update_bits

2019-03-24 Thread Kangjie Lu
regmap_update_bits could fail. The fix checks its status and if it fails, returns its error code upstream. Signed-off-by: Kangjie Lu --- sound/soc/codecs/cs35l34.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c index 5063c05afa27

[PATCH] sound: codecs: fix a potential NULL pointer dereference

2019-03-24 Thread Kangjie Lu
In case devm_kzalloc fails, the patch returns -ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- sound/soc/codecs/rt5663.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index da6647015708..909ab99a1995

[PATCH] gpio: fix a potential NULL pointer dereference

2019-03-24 Thread Kangjie Lu
In case devm_kzalloc, the patch returns ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/gpio/gpio-aspeed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 854bce4fb9e7..217507002dbc

[PATCH] platform: uv: fix missing checks for kcalloc

2019-03-24 Thread Kangjie Lu
In case kcalloc fails, the patch return an error to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- arch/x86/platform/uv/tlb_uv.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 2c53b0f19329

[PATCH] thunderbolt: property: fix a buffer overflow and a missing check

2019-03-24 Thread Kangjie Lu
First, no memory is allocated for "property->value.text"; the following strcpy will lead to a buffer overflow. Second, no check is enforced for the return value of kzalloc, which may lead to NULL-pointer dereference. The patch fixes the two issues. Signed-off-by: Kangjie Lu

[PATCH] vc04_services: vchiq_arm: fix a NULL pointer dereference

2019-03-24 Thread Kangjie Lu
When kzalloc fails, "platform_state->inited = 1" is a NULL pointer dereference. The fix returns VCHIQ_ERROR in case it failed to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 ++ 1 file changed,

[PATCH] dma: ti: fix a missing check in omap_dma_prep_dma_cyclic

2019-03-23 Thread Kangjie Lu
It is invalid when "buf_len" is not aligned with "period_len". The fix adds a check for the alignment. Signed-off-by: Kangjie Lu --- drivers/dma/ti/omap-dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.

[PATCH] firmware: edd: fix a NULL pointer dereference

2019-03-23 Thread Kangjie Lu
As other functions in this module do, edev should be checked to ensure that it is not NULL. The fix inserts such as check to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/firmware/edd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware

Re: [PATCH] mfd: fix a potential NULL pointer dereference

2019-03-22 Thread Kangjie Lu
Hi Lee Jones, Can you review this patch? Thanks. > On Mar 9, 2019, at 2:04 AM, Kangjie Lu wrote: > > In case devm_kzalloc fails, the fix does NULL check and returns > -ENOMEM upon failure so as to avoid NULL pointer dereference. > > Signed-off-by: Kangjie Lu > --- >

Re: [PATCH] memstick: fix a potential NULL pointer dereference

2019-03-22 Thread Kangjie Lu
Hi Maxim, Can you review this patch? Thanks, > On Mar 9, 2019, at 1:59 AM, Kangjie Lu wrote: > > In case alloc_ordered_workqueue fails, the fix returns ENOMEM to > avoid potential NULL pointer dereference. > > Signed-off-by: Kangjie Lu > --- > drivers/memstick/core/

[PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference

2019-03-22 Thread Kangjie Lu
In case of_device_get_match_data fails to find the matched data, returns -ENODEV Signed-off-by: Kangjie Lu --- drivers/input/misc/pm8xxx-vibrator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index

Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference

2019-03-22 Thread Kangjie Lu
> On Mar 8, 2019, at 11:19 PM, Kangjie Lu wrote: > > get_skb may fail and return NULL. The fix returns "ENOMEM" > when it fails to avoid NULL dereference. > > Signed-off-by: Kangjie Lu > --- > drivers/infiniband/hw/cxgb4/cm.c | 3 +++ > 1 file cha

Re: [PATCH] firmware: arm_scmi: check return value of idr_find

2019-03-22 Thread Kangjie Lu
> On Mar 8, 2019, at 10:02 PM, Kangjie Lu wrote: > > idr_find may return NULL, so check its return value and return an > error code. Can someone review this patch? Thanks. > > Signed-off-by: Kangjie Lu > --- > drivers/firmware/arm_scmi/driver.c | 2 ++ > 1

[tip:x86/urgent] x86/hyperv: Prevent potential NULL pointer dereference

2019-03-21 Thread tip-bot for Kangjie Lu
Commit-ID: 534c89c22e26b183d838294f0937ee092c82ad3a Gitweb: https://git.kernel.org/tip/534c89c22e26b183d838294f0937ee092c82ad3a Author: Kangjie Lu AuthorDate: Thu, 14 Mar 2019 00:46:51 -0500 Committer: Thomas Gleixner CommitDate: Thu, 21 Mar 2019 12:24:39 +0100 x86/hyperv: Prevent

[PATCH] extcon: fix a missing check of regmap_read

2019-03-20 Thread Kangjie Lu
When regmap_read fails, it doesn't make sense to use the read value "val" because it can be uninitialized. The fix returns if regmap_read fails. Signed-off-by: Kangjie Lu --- drivers/extcon/extcon-axp288.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/extcon/extcon-

[PATCH] rapidio: fix a NULL pointer dereference when create_workqueue fails

2019-03-19 Thread Kangjie Lu
In case create_workqueue fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/rapidio/rio_cm.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c index

[PATCH] extcon: fix a missing check of regmap_read

2019-03-18 Thread Kangjie Lu
When regmap_read fails, it doesn't make sense to use the read value "val" because it can be uninitialized. The fix returns if regmap_read fails. Signed-off-by: Kangjie Lu --- drivers/extcon/extcon-axp288.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/extcon/extcon-

[PATCH v2] iio: hmc5843: fix potential NULL pointer dereferences

2019-03-16 Thread Kangjie Lu
devm_regmap_init_i2c may fail and return NULL. The fix returns the error when it fails. Signed-off-by: Kangjie Lu --- V2: fix the two together --- drivers/iio/magnetometer/hmc5843_i2c.c | 7 ++- drivers/iio/magnetometer/hmc5843_spi.c | 7 ++- 2 files changed, 12 insertions(+), 2

[PATCH] security: inode: fix a missing check for securityfs_create_file

2019-03-15 Thread Kangjie Lu
securityfs_create_file may fail. The fix checks its status and returns the error code upstream if it fails. Signed-off-by: Kangjie Lu --- Return the exact error code upstream. --- security/inode.c | 5 + 1 file changed, 5 insertions(+) diff --git a/security/inode.c b/security/inode.c

[PATCH] tty: atmel_serial: fix a NULL pointer dereference

2019-03-15 Thread Kangjie Lu
In case dmaengine_prep_dma_cyclic fails, the fix returns a proper error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Fixes: 34df42f59a60 ("serial: at91: add rx dma support") --- V2: simplified the patch as suggested by Richard Genoud --- drivers/tty/serial/atme

[PATCH] fs: affs: fix a NULL pointer dereference

2019-03-15 Thread Kangjie Lu
If affs_bread fails, do not use ext_bh to avoid NULL pointer dereference Signed-off-by: Kangjie Lu --- fs/affs/file.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/affs/file.c b/fs/affs/file.c index a85817f54483..29cbc8eda085 100644 --- a/fs/affs/file.c +++ b/fs

[PATCH v2] tty: atmel_serial: fix a NULL pointer dereference

2019-03-15 Thread Kangjie Lu
Fixes: 34df42f59a60 ("serial: at91: add rx dma support") In case dmaengine_prep_dma_cyclic fails, the fix returns a proper error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- V2: simplified the patch as suggested by Richard Genoud --- drivers/tty/serial/atme

[PATCH v2] tty: atmel_serial: fix a NULL pointer dereference

2019-03-15 Thread Kangjie Lu
Fixes: 34df42f59a60 ("serial: at91: add rx dma support") In case dmaengine_prep_dma_cyclic fails, the fix returns a proper error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- V2: simplified the patch as suggested by Richard Genoud --- drivers/tty/serial/atme

[PATCH v2] tty: ipwireless: fix missing checks for ioremap

2019-03-15 Thread Kangjie Lu
ipw->attr_memory and ipw->common_memory are assigned with the return value of ioremap. ioremap may fail, but no checks are enforced. The fix inserts the checks to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu Reviewed-by: David Sterba --- V2: fix typos --- drive

[PATCH v2] infiniband: i40iw: fix potential NULL pointer dereferences

2019-03-15 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. The fix captures the failure and handles it properly to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu --- V2: add return value to capture the error code --- drivers/infiniband/hw/i40iw/i40iw.h | 2 +- drivers

[PATCH] slimbus: fix a NULL pointer dereference in of_qcom_slim_ngd_register

2019-03-15 Thread Kangjie Lu
In case platform_device_alloc fails, the fix returns an error code to avoid the NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/slimbus/qcom-ngd-ctrl.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index

[PATCH] pci: endpoint: fix a potential NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case alloc_workqueue, the fix returns -ENOMEM to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/pci/endpoint/functions/pci-epf-test.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci

[PATCH] tty: 8250: fix a missing check for pci_ioremap_bar

2019-03-14 Thread Kangjie Lu
pci_ioremap_bar could fail. The fix captures the failure and pass an error code upstream. This can avoid potential NULL pointer dereferences in the future. Signed-off-by: Kangjie Lu --- drivers/tty/serial/8250/8250_lpss.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff

[PATCH] security: inode: fix a missing check for securityfs_create_file

2019-03-14 Thread Kangjie Lu
securityfs_create_file may fail. The fix checks its status and returns EFAULT upstream if it fails. Signed-off-by: Kangjie Lu --- security/inode.c | 5 + 1 file changed, 5 insertions(+) diff --git a/security/inode.c b/security/inode.c index b7772a9b315e..11d9a6bc2161 100644 --- a/security

[PATCH] sound: sb8: add a check for request_region

2019-03-14 Thread Kangjie Lu
In case request_region fails, the fix returns an error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- sound/isa/sb/sb8.c | 4 1 file changed, 4 insertions(+) diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index aa2a83eb81a9..dc27a480c2d9 100644 --- a/sound/isa

[PATCH] sound: echoaudio: add a check for ioremap_nocache

2019-03-14 Thread Kangjie Lu
In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- sound/pci/echoaudio/echoaudio.c | 5 + 1 file changed, 5 insertions(+) diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio

[PATCH] sound: cs43130: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case create_singlethread_workqueue fails, the fix returns -ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- sound/soc/codecs/cs43130.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index

[PATCH] sound: rt5645: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
devm_kcalloc() may fail and return NULL. The fix returns ENOMEM in case it fails to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- sound/soc/codecs/rt5645.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index

[PATCH] sound: soc-pcm: add a check to avoid NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case debugfs_create_u32 fails, the fix frees memory and returns an error to notify callers. Signed-off-by: Kangjie Lu --- sound/soc/soc-pcm.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0d5ec68a1e50

[PATCH] fs: affs: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
If affs_bread fails, do not use ext_bh to avoid NULL pointer dereference Signed-off-by: Kangjie Lu --- fs/affs/file.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/affs/file.c b/fs/affs/file.c index a85817f54483..45b96faa40f1 100644 --- a/fs/affs/file.c

[PATCH] tty: mxs-auart: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereferences. Multiple places use port.membase. Signed-off-by: Kangjie Lu --- drivers/tty/serial/mxs-auart.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs

[PATCH] tty: atmel_serial: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case dmaengine_prep_dma_cyclic fails, the fix return a proper error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/tty/serial/atmel_serial.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b

[PATCH] tty: ipwireless: fix missing checks for ioremap

2019-03-14 Thread Kangjie Lu
ipw->attr_memory and ipw->common_memory are assigned with the return value of ioremap. ioremap may fail, but not checks are enforced. The fix insertss the checks. Signed-off-by: Kangjie Lu --- drivers/tty/ipwireless/main.c | 8 1 file changed, 8 insertions(+) diff --git a/drive

[PATCH] thunderbolt: fix a missing check of kmemdup

2019-03-14 Thread Kangjie Lu
kmemdup may fail and return NULL. The fix adds a check and returns NULL in case it fails to avoid NULL pointer dereferecen. Signed-off-by: Kangjie Lu --- drivers/thunderbolt/property.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt

[PATCH] greybus: audio_manager: fix a missing check of ida_simple_get

2019-03-14 Thread Kangjie Lu
ida_simple_get could fail. The fix inserts a check for its return value. Signed-off-by: Kangjie Lu --- drivers/staging/greybus/audio_manager.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c index

[PATCH] spi: fix NULL pointer dereferences by checking dmaengine_prep_slave_sg

2019-03-14 Thread Kangjie Lu
In case dmaengine_prep_slave_sg fails, the fix returns to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/spi/spi-s3c64xx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 7b7151ec14c8..3a5f161ce558 100644

[PATCH] rapidio: fix a NULL pointer derefenrece when create_workqueue fails

2019-03-14 Thread Kangjie Lu
In case create_workqueue fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/rapidio/rio_cm.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c index

[PATCH] power: charger-manager: fix a potential NULL pointer dereference

2019-03-14 Thread Kangjie Lu
In case create_freezable_workqueue fails, the fix return -ENOMEM to avoid a potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/power/supply/charger-manager.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/power/supply/charger-manager.c b/drivers/power

[PATCH] pci: pcie-xilinx: fix a missing-check bug for __get_free_pages

2019-03-13 Thread Kangjie Lu
In case __get_free_pages fail, the fix returns to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/pci/controller/pcie-xilinx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c index

[PATCH] pci: pci-tegra: fix a potential NULL pointer dereference

2019-03-13 Thread Kangjie Lu
In case __get_free_pages fails and returns NULL, the fix returns -ENOMEM and releases resources to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/pci/controller/pci-tegra.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/controller/pci-tegra.c b

[PATCH] hyperv: a potential NULL pointer dereference

2019-03-13 Thread Kangjie Lu
In case alloc_page, the fix returns -ENOMEM to avoid the potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- arch/x86/hyperv/hv_init.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 7abb09e2eeb8

[PATCH] infiniband: i40iw: fix potential NULL pointer dereferences

2019-03-13 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. The fix captures the failure and handles it properly to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu --- V2: add return value to capture the error code drivers/infiniband/hw/i40iw/i40iw.h | 2 +- drivers/infiniband

[PATCH v3] hid: logitech: check the return value of create_singlethread_workqueue

2019-03-13 Thread Kangjie Lu
create_singlethread_workqueue may fail and return NULL. The fix checks if it is NULL to avoid NULL pointer dereference. Also, the fix moves the call of create_singlethread_workqueue earlier to avoid resource-release issues. -- V3: do not introduce memory leaks. Signed-off-by: Kangjie Lu

[PATCH] thunderbolt: property: fix a NULL pointer dereference

2019-03-12 Thread Kangjie Lu
In case kzalloc fails, the fix releases resources and returns -ENOMEM to avoid the NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/thunderbolt/property.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt/property.c

[PATCH v2] media: rga: fix NULL pointer dereferences and a memory leak

2019-03-12 Thread Kangjie Lu
In case __get_free_pages fails, the fix releases resources and return -ENOMEM to avoid NULL pointer dereferences. Also, the fix frees pages when video_register_device fails to avoid a memory leak. Signed-off-by: Kangjie Lu --- drivers/media/platform/rockchip/rga/rga.c | 15 ++- 1

[PATCH v2] hid: logitech: check the return value of create_singlethread_workqueue

2019-03-12 Thread Kangjie Lu
create_singlethread_workqueue may fail and return NULL. The fix checks if it is NULL to avoid NULL pointer dereference. Also, the fix moves the call of create_singlethread_workqueue earlier to avoid resource-release issues. Signed-off-by: Kangjie Lu --- drivers/hid/hid-logitech-hidpp.c | 8

Re: [PATCH] net: fjes: fix potential NULL pointer dereferences

2019-03-11 Thread Kangjie Lu
> On Mar 11, 2019, at 6:19 PM, David Miller wrote: > > From: Kangjie Lu > Date: Mon, 11 Mar 2019 02:10:21 -0500 > >> adapter->control_wq = alloc_workqueue(DRV_NAME "/control", >>WQ_MEM_RECLA

[PATCH v2] net: brcm80211: fix missing checks for kmemdup

2019-03-11 Thread Kangjie Lu
In case kmemdup fails, the fix sets conn_info->req_ie_len to zero to avoid buffer overflows. Signed-off-by: Kangjie Lu --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmf

[PATCH v2] mmc_spi: add a status check for spi_sync_locked

2019-03-10 Thread Kangjie Lu
In case spi_sync_locked fails, the fix reports the error and returns the error code upstream. Signed-off-by: Kangjie Lu --- drivers/mmc/host/mmc_spi.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 1b1498805972..a3533935e282

[PATCH] net: liquidio: fix a NULL pointer dereference

2019-03-10 Thread Kangjie Lu
In case octeon_alloc_soft_command fails, the fix reports the error and returns to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/cavium/liquidio

[PATCH] net: 8390: fix potential NULL pointer dereferences

2019-03-10 Thread Kangjie Lu
In case ioremap fails, the fix returns to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/8390/pcnet_cs.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index

[PATCH] net: lan9303: fix missing error handling

2019-03-10 Thread Kangjie Lu
Both lan9303_phy_write and regmap_write may fail. The fix adds the error handling to print error messages upon failure. Signed-off-by: Kangjie Lu --- drivers/net/dsa/lan9303-core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303

[PATCH] net: spi: fix a potential NULL pointer dereference

2019-03-09 Thread Kangjie Lu
In case alloc_workqueue fails to allocate the work queue and returns NULL, the fix releases the resources and returns -ENOMEM. Signed-off-by: Kangjie Lu --- drivers/net/can/spi/mcp251x.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can

[PATCH] mmc_spi: add a status check for spi_sync_locked

2019-03-09 Thread Kangjie Lu
In case spi_sync_locked fails, the fix reports the error and returns the error code upstream. Signed-off-by: Kangjie Lu --- drivers/mmc/host/mmc_spi.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 1b1498805972..32fea585262b

[PATCH] iio: hmc5843_spi: fix a NULL pointer dereference

2019-03-09 Thread Kangjie Lu
In case devm_regmap_init_spi fails and returns NULL, the fix returns an error to avoid NULL pointer dereference Signed-off-by: Kangjie Lu --- drivers/iio/magnetometer/hmc5843_spi.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/hmc5843_spi.c

[PATCH] mfd: fix a potential NULL pointer dereference

2019-03-09 Thread Kangjie Lu
In case devm_kzalloc fails, the fix does NULL check and returns -ENOMEM upon failure so as to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/mfd/sm501.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index a530972c5a7e

[PATCH] memstick: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case alloc_ordered_workqueue fails, the fix returns ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/memstick/core/ms_block.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c

[PATCH] media: usbvision: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case usb_alloc_coherent fails, the fix returns -ENOMEM to avoid a potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/media/usb/usbvision/usbvision-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers

[PATCH] media: video-mux: fix null pointer dereferences

2019-03-08 Thread Kangjie Lu
devm_kcalloc may fail and return a null pointer. The fix returns -ENOMEM upon failures to avoid null pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/media/platform/video-mux.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/video-mux.c b/drivers

[PATCH] media: renesas-ceu: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case of_match_device cannot find a match, the check returns -EINVAL to avoid a potential NULL pointer dereference Signed-off-by: Kangjie Lu --- drivers/media/platform/renesas-ceu.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas-ceu.c b

[PATCH] media: rcar-vin: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case of_match_node cannot find a match, the fix returns -EINVAL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/media/platform/rcar-vin/rcar-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media

[PATCH] media: vpss: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/media/platform/davinci/vpss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c index

[PATCH] media: rga: fix NULL pointer dereferences

2019-03-08 Thread Kangjie Lu
In case __get_free_pages fails, return -ENOMEM to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/media/platform/rockchip/rga/rga.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga

[PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD

2019-03-08 Thread Kangjie Lu
Conservatively check return value of STV090x_WRITE_DEMOD in case it fails. Signed-off-by: Kangjie Lu --- drivers/media/dvb-frontends/stv090x.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb

[PATCH] leds: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case of_match_device cannot find a match, the fixes returns -EINVAL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/leds/leds-pca9532.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532

[PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/isdn/hardware/mISDN/mISDNinfineon.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn

[PATCH] isdn: hfcpci: fix potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case ioremap fails, the fix reports an error and returns. Signed-off-by: Kangjie Lu --- drivers/isdn/hardware/mISDN/hfcpci.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index ebb3fa2e1d00..b400d6528a56

[PATCH] input: pm8xxx-vibrator: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case of_device_get_match_data fails to find the matched data, returns -ENODEV Signed-off-by: Kangjie Lu --- drivers/input/misc/pm8xxx-vibrator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index

[PATCH] infiniband: i40iw: fix potential NULL pointer dereferences

2019-03-08 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. Let's check its return value to ensure it is not NULL so as to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 12 1 file changed, 12 insertions(+) diff --git

[PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
get_skb may fail and return NULL. The fix returns "ENOMEM" when it fails to avoid NULL dereference. Signed-off-by: Kangjie Lu --- drivers/infiniband/hw/cxgb4/cm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/

[PATCH] iio: hmc: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
devm_regmap_init_i2c may fail and return NULL. The fix returns the error when it fails. Signed-off-by: Kangjie Lu --- drivers/iio/magnetometer/hmc5843_i2c.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio

[PATCH] iio: adc: fix a potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
devm_iio_trigger_alloc may fail and return NULL. The fix returns ENOMEM when it fails. Signed-off-by: Kangjie Lu --- drivers/iio/adc/mxs-lradc-adc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c index c627513d9f0f

[PATCH] iio: max9611: fix a NULL pointer dereference

2019-03-08 Thread Kangjie Lu
of_match_device may return NULL when it fails, and in this case, there will be a NULL pointer dereference. The fix returns EINVAL when of_match_device returns NULL. Signed-off-by: Kangjie Lu --- drivers/iio/adc/max9611.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git

[PATCH] hid: logitech: check the return value of create_singlethread_workqueue

2019-03-08 Thread Kangjie Lu
create_singlethread_workqueue may fail and return NULL. The fix checks if it is NULL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/hid/hid-logitech-hidpp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid

[PATCH] drm: vkms: check status of alloc_ordered_workqueue

2019-03-08 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. The fix returns ENOMEM when it fails to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/vkms/vkms_crtc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu

[PATCH] drm: check if alloc_workqueue fails

2019-03-08 Thread Kangjie Lu
alloc_workqueue may fail. The fix checks its status. We probably need to add a return value for radeon_crtc_init, so that we can pass an error code upstream. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/radeon/radeon_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu

[PATCH] gpu: i915: fix a missing check of get_free_page

2019-03-08 Thread Kangjie Lu
If the allocation fails, return false to avoid potential NULL pointer dereference Signed-off-by: Kangjie Lu --- drivers/gpu/drm/i915/i915_gpu_error.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915

[PATCH] gpu: amdkfd: fix a missing check of kmemdup

2019-03-08 Thread Kangjie Lu
kmemdup could fail and return NULL. To avoid null pointer dereference, the fix checkes its return value and returns ENOMEM upon failures. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd

[PATCH] gpio: add a check for the return value of ida_simple_get fails

2019-03-08 Thread Kangjie Lu
ida_simple_get may fail and return a negative error number. The fix checks its return value; if it fails, go to err_destroy. Signed-off-by: Kangjie Lu --- drivers/gpio/gpio-exar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index

[PATCH] firmware: arm_scmi: check return value of idr_find

2019-03-08 Thread Kangjie Lu
idr_find may return NULL, so check its return value and return an error code. Signed-off-by: Kangjie Lu --- drivers/firmware/arm_scmi/driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 8f952f2f1a29

[PATCH] char: hpet: fix a missing check of ioremap

2019-03-08 Thread Kangjie Lu
Check if ioremap fails, and if so, return AE_ERROR. Signed-off-by: Kangjie Lu --- drivers/char/hpet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index d0ad85900b79..3a1e6b3ccd10 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c

[PATCH] net: ixgbevf: fix a missing check of ixgbevf_write_msg_read_ack

2019-03-08 Thread Kangjie Lu
If ixgbevf_write_msg_read_ack fails, return its error code upstream Signed-off-by: Kangjie Lu --- drivers/net/ethernet/intel/ixgbevf/vf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c

Re: [PATCH] isdn: mISDN: Fix potential NULL pointer dereference of kzalloc

2019-03-02 Thread Kangjie Lu
On 3/2/19 3:26 PM, Gustavo A. R. Silva wrote: On 3/2/19 3:20 PM, Aditya Pakki wrote: Allocating memory via kzalloc for phi may fail and causes a NULL pointer dereference. This patch avoids such a scenario. Was this detected by Coccinelle? It was detected by an LLVM-based static analyzer

[tip:sched/core] sched/core: Fix a potential double-fetch bug in sched_copy_attr()

2019-01-21 Thread tip-bot for Kangjie Lu
Commit-ID: 120e4e76857ddbc9268e1aa3f9de61a498e84618 Gitweb: https://git.kernel.org/tip/120e4e76857ddbc9268e1aa3f9de61a498e84618 Author: Kangjie Lu AuthorDate: Wed, 9 Jan 2019 01:45:24 -0600 Committer: Ingo Molnar CommitDate: Mon, 21 Jan 2019 11:26:17 +0100 sched/core: Fix a potential

[PATCH v2] target: fix a missing check of match_int

2019-01-11 Thread Kangjie Lu
When match_int fails, "arg" is left uninitialized and may contain random value, thus should not be used. The fix checks if match_int fails, and if so, returns its error code. Signed-off-by: Kangjie Lu --- drivers/target/target_core_rd.c | 15 +-- 1 file changed, 13 insert

  1   2   3   >