[PATCH v4] tty: rocket: Remove the rp_ioctl

2019-04-16 Thread Fuqian Huang
off-by: Fuqian Huang --- drivers/tty/rocket.c | 154 +-- drivers/tty/rocket.h | 10 2 files changed, 1 insertion(+), 163 deletions(-) diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index b121d8f8f3d7..e3b4e8bc2d7a 100644 --- a/driv

[PATCH v5 01/02] tty: rocket: Remove RCPK_GET_STRUCT ioctl

2019-04-17 Thread Fuqian Huang
If the cmd is RCPK_GET_STRUCT, copy_to_user will copy info to user space. As info->port.ops is the address of a constant object rocket_port_ops (assigned in init_r_port), a kernel address leakage happens. Remove the RCPK_GET_STRUCT ioctl. Signed-off-by: Fuqian Huang --- drivers/tty/rocke

[PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl

2019-04-17 Thread Fuqian Huang
This patch depends on patch 01. The rp_ioctl is deprecated. Add dev_warn_ratelimited to warn the use of rp_ioctl. Signed-off-by: Fuqian Huang --- drivers/tty/rocket.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index b6543e28bd8b

[PATCH v3] sound: isa: gus: fix misuse of %x

2019-04-25 Thread Fuqian Huang
Pointers should be printed with %p or %px rather than cast to long type and printed with %lx. Drop the address printing. Signed-off-by: Fuqian Huang --- sound/isa/gus/gus_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c

[PATCH] KVM: x86: work around leak of uninitialized stack contents

2019-09-11 Thread Fuqian Huang
; however, it is not an easy fix, so for now just ensure that the error code and CR2 are zero. Signed-off-by: Fuqian Huang --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 290c3c3efb87..7f442d710858 100644 --- a/arch/x86/kvm/x86.c

Re: [PATCH] KVM: x86: work around leak of uninitialized stack contents

2019-09-12 Thread Fuqian Huang
Vitaly Kuznetsov 於 2019年9月12日週四 下午4:51寫道: > > Fuqian Huang writes: > > > Emulation of VMPTRST can incorrectly inject a page fault > > when passed an operand that points to an MMIO address. > > The page fault will use uninitialized kernel stack memory > > as th

Re: [PATCH] KVM: x86: work around leak of uninitialized stack contents

2019-09-12 Thread Fuqian Huang
Vitaly Kuznetsov 於 2019年9月12日週四 下午6:53寫道: > > Fuqian Huang writes: > > > Vitaly Kuznetsov 於 2019年9月12日週四 下午4:51寫道: > >> > >> Fuqian Huang writes: > >> > >> > Emulation of VMPTRST can incorrectly inject a page fault > >> > when

[PATCH] mtd: maps: l440gx: Avoid print address to dmesg

2019-10-10 Thread Fuqian Huang
Avoid print the address of l440gx_map.virt every time l440gx init. Signed-off-by: Fuqian Huang --- drivers/mtd/maps/l440gx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index 876f12f40018..e7e40bca82d1 100644 --- a/drivers/mtd/maps

[PATCH] xen/grant-table: remove unnecessary printing

2019-10-10 Thread Fuqian Huang
xen_auto_xlat_grant_frames.vaddr is definitely NULL in this case. So the address printing is unnecessary. Signed-off-by: Fuqian Huang --- drivers/xen/grant-table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index

[PATCH] m68k: q40: Fix info-leak in rtc_ioctl

2019-09-27 Thread Fuqian Huang
. This will leak uninitialized stack content to userland. Fix this by zeroing the uninitialized field. Signed-off-by: Fuqian Huang --- arch/m68k/q40/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index e63eb5f06999..f31890078197 100644

[PATCH v2] mtd: maps: l440gx: Avoid printing address to dmesg

2019-10-10 Thread Fuqian Huang
Avoid printing the address of l440gx_map.virt every time l440gx init. Signed-off-by: Fuqian Huang --- drivers/mtd/maps/l440gx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index 876f12f40018..ebe37edc8e88 100644 --- a

[PATCH v3] mtd: maps: l440gx: Avoid printing address to dmesg

2019-10-10 Thread Fuqian Huang
Avoid printing the address of l440gx_map.virt every time l440gx init. Signed-off-by: Fuqian Huang --- Changes in v3: -- use pr_debug instead of printk(KERN_DEBUG) drivers/mtd/maps/l440gx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/l440gx.c b/drivers

Potential info leak: Kernel pointer leak?

2019-01-22 Thread Fuqian Huang
Hi, recently I came across some code and it seems to be able to leak kernel address? Is the following code cause info leak in the Linux kernel? The callback function address is printed to debugfs. The local user could know the kernel object address, and is able to bypass kASLR. linux-4.14.90 driver

a kernel address leak via copy_to_user in drivers/tty/rocket.c

2019-03-30 Thread Fuqian Huang
Hi, recently I found that there is a kernel address leaks to user space via copy_to_user in drivers/tty/rocket.c:1287 (linux-5.0.5) static int rp_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { ... case RCKP_GET_STRUCT: if (copy_to_user(argp, info, sizeof(struct r_por

Re: a kernel address leak via copy_to_user in drivers/tty/rocket.c

2019-03-30 Thread Fuqian Huang
sked_info); >1306 if (copy_to_user(argp, masked_info, sizeof (struct r_port))) 1307 ret = -EFAULT; Greg KH 於 2019年3月30日週六 下午3:14寫道: > > On Sat, Mar 30, 2019 at 03:05:11PM +0800, Fuqian Huang wrote: > > Hi, recently I found that there is a kernel address l

[PATCH v2] tty: rocket: Fix a kernel address leak in rp_ioctl

2019-03-30 Thread Fuqian Huang
oid kernel address leakage. Signed-off-by: Fuqian Huang --- drivers/tty/rocket.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index b121d8f8f3d7..a7bcf44b61bd 100644 --- a/drivers/tty/rocket.c ++

[PATCH v3] tty: rocket: Fix a kernel address leakage in rp_ioctl

2019-03-31 Thread Fuqian Huang
ore copy_to_user. Another reason is that I have checked all uses of copy_to_user and copy_from_user in this file, they do not use any of these pointer fields. So these pointer fields can be set NULL safely. Signed-off-by: Fuqian Huang --- drivers/tty/rocket.c |

[PATCH] Fix some misuses of %x

2019-04-19 Thread Fuqian Huang
The pointers should be printed with %p or %px rather than cast to long or unsigned long type and printed with %x. Change %x to %p to print pointers. Signed-off-by: Fuqian Huang --- drivers/atm/iphase.c | 4 ++-- drivers/misc/genwqe/card_debugfs.c | 4 ++-- drivers/net/hippi

[PATCH v2 03/06] misc: genwqe: Fix misuse of %x

2019-04-21 Thread Fuqian Huang
The pointer should be printed with %p or %px rather than cast to long long type and printed with %016llx. Change %x to %p to print the pointer. Signed-off-by: Fuqian Huang --- drivers/misc/genwqe/card_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc

[PATCH v2 02/06] kernel: cgroup: fix misuse of %x

2019-04-21 Thread Fuqian Huang
Pointers should be printed with %p or %px rather than cast to unsigned long type and printed with %lx. Change %lx to %p to print the pointers. Signed-off-by: Fuqian Huang --- kernel/cgroup/debug.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/cgroup/debug.c

[PATCH v2 06/06] sound: isa: gus: fix misuse of %x

2019-04-21 Thread Fuqian Huang
Pointers should be printed with %p or %px rather than cast to long type and printed with %lx. Change %lx to %p to print the pointer. Signed-off-by: Fuqian Huang --- sound/isa/gus/gus_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/isa/gus/gus_mem.c b/sound/isa

[PATCH] staging: vchiq_arm: Fix misuse of %x

2019-04-22 Thread Fuqian Huang
Pointers should be printed with %p or %px rather than cast to unsigned long type and printed with %lx. Change %lx to %pK to print the pointers. Signed-off-by: Fuqian Huang --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 1 file changed, 4 insertions(+), 4

[PATCH] staging: vchiq_arm: Fix misuse of %x

2019-04-22 Thread Fuqian Huang
Pointers should be printed with %p or %px rather than cast to unsigned long type and printed with %lx. Change %lx to %pK to print the pointers. Signed-off-by: Fuqian Huang --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 1 file changed, 4 insertions(+), 4

[PATCH v3 02/24] atm: idt77252: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/at

[PATCH v3 03/24] dmaengine: imx-sdma: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drive

[PATCH v3 01/24] sh: mm: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message

[PATCH v3 04/24] dmaengine: qcom_hidma: Remove call to memset after dmam_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message driver

[PATCH v3 06/24] i2c: ismt: Remove call to memset after dmam_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Acked-by: Neil Horman Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the comm

[PATCH v3 07/24] rdma/cxgb3: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 08/24] rdma/cxgb4: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 10/24] IB/mthca: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 09/24] rdma/hns: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 12/24] RDMA/ocrdma: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 14/24] media: ngene: Remove call to memset after pci_alloc_consistent

2019-07-14 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 11/24] RDMA/nes: Remove call to memset after pci_alloc_consistent

2019-07-14 Thread Fuqian Huang
pci_alloc_consitent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 17/24] ethernet: remove redundant memset

2019-07-14 Thread Fuqian Huang
not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/net/ethernet/atheros/atlx/atl1.c | 2 -- drivers/net/ethernet/atheros/atlx/atl2.c | 1 - drivers/net/ethernet/broadcom/b

[PATCH v3 15/24] media: exynos4-is: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message dri

[PATCH v3 13/24] IB/ipoib: remove unneeded memset

2019-07-14 Thread Fuqian Huang
vzalloc has already zeroed the memory during the allocation. So memset is unneeded. Signed-off-by: Fuqian Huang --- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index

[PATCH v3 18/24] hippi: Remove call to memset after pci_alloc_consistent

2019-07-14 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 16/24] scsi: mptfusion: Remove call to memset after pci_alloc_consistent

2019-07-14 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 22/24] tty: serial: Remove call to memset after pci_alloc_consistent

2019-07-14 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 21/24] scsi: Remove redundant memset

2019-07-14 Thread Fuqian Huang
kcalloc already zeros the memory during allocation. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So the memset after these functions is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: -

[PATCH v3 19/24] vmxnet3: Remove call to memset after dma_alloc_coherent

2019-07-14 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/n

Re: [PATCH v3 04/24] dmaengine: qcom_hidma: Remove call to memset after dmam_alloc_coherent

2019-07-14 Thread Fuqian Huang
Sinan Kaya 於 2019年7月15日週一 下午12:17寫道: > > On 7/14/2019 11:17 PM, Fuqian Huang wrote: > > In commit 518a2f1925c3 > > ("dma-mapping: zero memory returned from dma_alloc_*"), > > dma_alloc_coherent has already zeroed the memory. > > So memset is not needed. &g

Re: [PATCH v3 15/24] media: exynos4-is: Remove call to memset after dma_alloc_coherent

2019-07-15 Thread Fuqian Huang
Sylwester Nawrocki 於 2019年7月15日週一 下午5:00寫道: > > On 7/15/19 05:18, Fuqian Huang wrote: > > In commit 518a2f1925c3 > > ("dma-mapping: zero memory returned from dma_alloc_*"), > > dma_alloc_coherent has already zeroed the memory. > > So memset is not needed

[PATCH] mfd: ezx-pcap: replace mutex_lock with spin_lock

2019-08-13 Thread Fuqian Huang
As mutex_lock might sleep. Function pcap_adc_irq is an interrupt handler. The use of mutex_lock in pcap_adc_irq may cause sleep in IRQ context. Replace mutex_lock with spin_lock to avoid this. Signed-off-by: Fuqian Huang --- drivers/mfd/ezx-pcap.c | 53

[PATCH v2] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context

2019-08-08 Thread Fuqian Huang
As spin_unlock_irq will enable interrupts. Function tsi108_stat_carry is called from interrupt handler tsi108_irq. Interrupts are enabled in interrupt handler. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq in IRQ context to avoid this. Signed-off-by: Fuqian Huang

[PATCH] scsi: lpfc: use spin_lock_irqsave instead of spin_lock_irq in IRQ context

2019-08-12 Thread Fuqian Huang
intr_handler <- lpfc_sli_intr_handler and lpfc_sli_intr_handler is an interrupt handler. Interrupts are enabled in interrupt handler. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq in IRQ context to avoid this. Signed-off-by: Fuqian Huang --- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +++--

[PATCH] dmaengine: pl330: use the same attributes when freeing pl330->mcode_cpu

2019-07-26 Thread Fuqian Huang
In function dmac_alloc_resources(), pl330->mcode_cpu is allocated using dma_alloc_attrs() but freed with dma_free_coherent(). Use the correct dma_free_attrs() function to free pl330->mcode_cpu. Signed-off-by: Fuqian Huang --- drivers/dma/pl330.c | 9 + 1 file changed, 5 insertions

Is it safe to kmalloc a large size of memory in interrupt handler?

2019-08-05 Thread Fuqian Huang
In the implementation of kmalloc. when the allocated size is larger than KMALLOC_MAX_CACHE_SIZE, it will call kmalloc_large to allocate the memory. kmalloc_large -> kmalloc_order_trace->kmalloc_order->alloc_pages->alloc_pages_current->alloc_pages_nodemask->get_page_from_freelist->node_reclaim->__no

[PATCH] i2c: avoid sleep in IRQ context

2019-08-05 Thread Fuqian Huang
i2c_pxa_handler -> i2c_pxa_irq_txempty -> i2c_pxa_reset -> i2c_pxa_set_slave -> i2c_pxa_wait_slave As i2c_pxa_handler is an interrupt handler, it will finally calls i2c_pxa_wait_slave which calls msleep. Add in_interrupt check before msleep to avoid sleep in IRQ context. Signed-of

[PATCH] sgi-xpc: Use GFP_ATOMIC for kmalloc in atomic context.

2019-08-05 Thread Fuqian Huang
c_system_die may be called in atomic context. So the kmalloc in xpc_send_activate_IRQ_uv may be in atomic context. Use GFP_ATOMIC instead of GFP_KERNEL in kmalloc. Signed-off-by: Fuqian Huang --- drivers/misc/sgi-xp/xpc_uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driv

Re: [PATCH] drm: use trace_printk rather than printk in drm_dbg.

2019-07-30 Thread Fuqian Huang
Joe Perches 於 2019年7月31日週三 下午2:06寫道: > > On Wed, 2019-07-31 at 10:45 +0800, Fuqian Huang wrote: > > In drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c, > > amdgpu_ih_process calls DRM_DEBUG which calls drm_dbg and > > finally calls printk. > > As amdgpu_ih_process is ca

[PATCH] libata-sff: use spin_lock_irqsave instead of spin_lock_irq in IRQ context.

2019-08-06 Thread Fuqian Huang
rrupts are enabled in interrupt handler. Use spin_lock_irqsave instead of spin_lock_irq to avoid this. Signed-off-by: Fuqian Huang --- drivers/ata/libata-sff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 10aa2

Re: [PATCH] i2c: avoid sleep in IRQ context

2019-08-07 Thread Fuqian Huang
Adamski, Krzysztof (Nokia - PL/Wroclaw) 於 2019年8月7日週三 下午2:51寫道: > > On Mon, Aug 05, 2019 at 08:31:34PM +0800, Fuqian Huang wrote: > >i2c_pxa_handler -> i2c_pxa_irq_txempty -> > >i2c_pxa_reset -> i2c_pxa_set_slave -> i2c_pxa_wait_slave > > > >As i2c_px

[PATCH v2] i2c: avoid sleep in IRQ context

2019-08-07 Thread Fuqian Huang
in interrupt context, use mdelay instead of msleep. Signed-off-by: Fuqian Huang --- drivers/i2c/busses/i2c-pxa.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 2c3c3d6935c0..876e693bafd9 100644 --- a/drivers/i2

[PATCH] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context

2019-08-07 Thread Fuqian Huang
As spin_unlock_irq will enable interrupts. Function tsi108_stat_carry is called from interrupt handler tsi108_irq. Interrupts are enabled in interrupt handler. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq in IRQ context to avoid this. Signed-off-by: Fuqian Huang

[PATCH] rtc: mxc: use spin_lock_irqsave instead of spin_lock_irq in IRQ context

2019-08-07 Thread Fuqian Huang
As spin_unlock_irq will enable interrupts. mxc_rtc_irq_enable is called from interrupt handler mxc_rtc_interrupt. Interrupts are enabled in interrupt handler. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq in IRQ context to avoid this. Signed-off-by: Fuqian Huang

[PATCH] scsi: lpfc: remove redundant code

2019-08-07 Thread Fuqian Huang
Remove the redundant initialization code. Signed-off-by: Fuqian Huang --- drivers/scsi/lpfc/lpfc_bsg.c | 1 - drivers/scsi/lpfc/lpfc_sli.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index b7216d694bff..5f66a2da2599 100644

[PATCH v3 02/27] ata: Remove memset after dma_alloc_coherent/dmam_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent/dmam_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the comm

[PATCH v3 03/27] atm: idt77252: remove memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/at

[PATCH v3 07/27] drm/amdgpu: remove memset after zalloc

2019-07-02 Thread Fuqian Huang
zalloc has already zeroed the memory. so memset is unneeded. Signed-off-by: Fuqian Huang --- Changes in v3: - Changes in title: gpu: drm -> drm/amdgpu drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 2 -- drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c

[PATCH v3 06/27] dma: remove memset after dma_alloc_coherent/dmam_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent/dmam_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the comm

[PATCH v3 04/27] block: remove memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message dri

[PATCH v3 05/27] crypto: remove memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/c

[PATCH v3 01/27] sh: mm: Remove call to memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message

[PATCH v3 13/27] message: fusion: remove memset after pci_alloc_consistent

2019-07-02 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 11/27] media: remove memset after dma_alloc_coherent/pci_alloc_consistent

2019-07-02 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset after these 2 functions is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: -

[PATCH v3 14/27] mtd: nand: use kzalloc instead of kmalloc and memset

2019-07-02 Thread Fuqian Huang
Replace kmalloc followed by a memset with kzalloc. There is a recommendation to use zeroing allocator rather than allocator followed by memset with 0 in ./scripts/coccinelle/api/alloc/zalloc-simple.cocci Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/mtd/nand/raw/nand_bch.c

[PATCH v3 12/27] media: use kzalloc instead of kmalloc and memset

2019-07-02 Thread Fuqian Huang
Replace kmalloc followed by a memset with kzalloc. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/media/usb/pvrusb2/pvrusb2-eeprom.c | 3 +-- drivers/media/usb/pvrusb2/pvrusb2-hdw.c| 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb

[PATCH v3 09/27] infiniband: remove unneeded memset

2019-07-02 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent/dmam_alloc_coherent has already zeroed the memory. So the memset after these 3 function calls is not needed. Signed-off-by: Fu

[PATCH v3 08/27] i2c: busses: remove memset after dmam_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dmam_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/

[PATCH v3 19/27] staging: rtl8*: use zeroing allocator rather than allocator followed with memset 0

2019-07-02 Thread Fuqian Huang
Use zeroing allocator rather than allocator followed with memset 0. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/staging/rtl8188eu/os_dep/mlme_linux.c | 3 +-- drivers/staging/rtl8712/rtl871x_io.c | 4 +--- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211

[PATCH v3 17/27] scsi: remove unneeded memset

2019-07-02 Thread Fuqian Huang
not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/scsi/3w-9xxx.c| 2 -- drivers/scsi/3w-.c| 2 -- drivers/scsi/aacraid/rx.c | 1 - drivers/scsi/arcmsr/ar

[PATCH v3 20/27] staging: rtl8723bs: remove unneeded memset

2019-07-02 Thread Fuqian Huang
rtw_zmalloc already zeroes the memory, so memset is unneeded. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/staging/rtl8723bs/core/rtw_ap.c | 2 -- drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs

[PATCH v3 18/27] scsi: use zeroing allocator rather than allocator followed by memset 0

2019-07-02 Thread Fuqian Huang
Replace allocator followed by memset with 0 with zeroing allocator. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/scsi/lpfc/lpfc_debugfs.c | 5 + drivers/scsi/qedf/qedf_dbg.c | 3 +-- drivers/scsi/qla2xxx/qla_attr.c | 7 ++- 3 files changed, 4 insertions(+), 11

[PATCH v3 22/27] usb: remove unneeded memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message driver

[PATCH v3 21/27] tty: remove unneeded memset

2019-07-02 Thread Fuqian Huang
pci_alloc_consistent calls dma_alloc_coherent directly. In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rathe

[PATCH v3 16/27] net: remove unneeded memset

2019-07-02 Thread Fuqian Huang
d. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/net/ethernet/atheros/atlx/atl1.c | 2 -- drivers/net/ethernet/atheros/atlx/atl2.c | 1 - drivers/net/ethernet/broadcom/b

[PATCH v3 15/27] net: use zeroing allocator rather than allocator followed by memset zero

2019-07-02 Thread Fuqian Huang
Replace allocator followed by memset with 0 with zeroing allocator. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/net/eql.c | 3 +-- drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c | 4 +--- drivers/net/ethernet/cavium/liquidio

[PATCH v3 23/27] video: fbdev: remove unneeded memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message drivers/v

[PATCH v3 25/27] kernel: power: use kzalloc rather than kmalloc followed with memset

2019-07-02 Thread Fuqian Huang
Use zeroing allocator instead of using allocator followed with memset with 0 Signed-off-by: Fuqian Huang --- Changes in v3: - Resend kernel/power/swap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index e1912ad13bdc

[PATCH v3 27/27] sound: ppc: remove unneeded memset after dma_alloc_coherent

2019-07-02 Thread Fuqian Huang
In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang --- Changes in v3: - Use actual commit rather than the merge commit in the commit message sound/ppc/

[PATCH v3 26/27] sound: oss: use kzalloc rather than kmalloc with memset

2019-07-02 Thread Fuqian Huang
Use zeroing allocator instead of using allocator followed with memset with 0. Signed-off-by: Fuqian Huang --- Changes in v3: - Resend sound/core/seq/oss/seq_oss_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq

[PATCH v3 24/27] fs: jffs2: use kzalloc rather than kmalloc followed with memset

2019-07-02 Thread Fuqian Huang
Use zero allocator rather than kmalloc followed with memset with 0. Signed-off-by: Fuqian Huang --- Changes in v3: - Fix pr_warn message. fs/jffs2/erase.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index 83b8f06b4a64

[PATCH v3 10/27] md: use kzalloc instead of kmalloc and memset

2019-07-02 Thread Fuqian Huang
Replace kmalloc followed by a memset with kzalloc Signed-off-by: Fuqian Huang --- Changes in v3: - Resend drivers/md/dm-integrity.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 44e76cda087a..f5db89b28757

Re: [PATCH 2/4] input: keyboard/mouse/touchscreen/misc: Use dev_get_drvdata()

2019-07-02 Thread Fuqian Huang
Fuqian, > > On Mon, Jul 01, 2019 at 11:23:12AM +0800, Fuqian Huang wrote: > > Using dev_get_drvdata directly. > > > > I prefer using proper bus accessors. > > Thanks. > > -- > Dmitry

Re: [PATCH 2/4] input: keyboard/mouse/touchscreen/misc: Use dev_get_drvdata()

2019-07-02 Thread Fuqian Huang
Andy Shevchenko 於 2019年7月2日週二 下午5:51寫道: > > On Tue, Jul 2, 2019 at 11:20 AM Fuqian Huang wrote: > > > > I am not an expert on this. I just write a coccinelle script to search > > this kind of misuse and fix it in a naive way. > > Could you tell me about how to use

[PATCH 02/30] powerpc: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Add an allocation failure check. Signed-off-by: Fuqian Huang --- arch/powerpc/platforms/pseries/dlpar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms

[PATCH 03/30] block: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index e5009a34f9c2..47ad3772dc58 100644 --- a/drivers/block/rbd.c +++ b/drivers

[PATCH 01/30] ia64/sn: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- arch/ia64/sn/kernel/io_acpi_init.c | 8 +++- arch/ia64/sn/pci/tioce_provider.c | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn

[PATCH 04/30] clk/ti: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/clk/ti/dpll.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index 659dadb23279..f728d987ebac 100644 --- a/drivers/clk/ti/dpll.c +++ b

[PATCH 08/30] infiniband: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 8233f5a4e623

[PATCH 09/30] macintosh: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/macintosh/adbhid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index 75482eeab2c4..5d14bebfb58f 100644 --- a/drivers

[PATCH 10/30] media/dvb: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/media/dvb-core/dvbdev.c | 3 +-- drivers/media/dvb-frontends/drx39xyj/drxj.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers

[PATCH 11/30] media/tuners: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/media/tuners/tuner-xc2028.c | 3 +-- drivers/media/tuners/xc4000.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners

[PATCH 12/30] media/usb: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/media/usb/em28xx/em28xx-cards.c | 3 +-- drivers/media/usb/zr364xx/zr364xx.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers

[PATCH 13/30] message/fusion: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index d8882b0a1338..e0c57cecddd3 100644

[PATCH 14/30] net/ethernet: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox

[PATCH 16/30] net/wireless: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Fuqian Huang
kmemdup rather than using kmalloc/kzalloc + memset. Signed-off-by: Fuqian Huang --- drivers/net/wireless/ath/ath6kl/wmi.c | 6 ++ drivers/net/wireless/st/cw1200/queue.c | 3 +-- drivers/net/wireless/ti/wlcore/main.c | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a

  1   2   3   >