mfd: ti_am335x_tscadc: Use PLATFORM_DEVID_AUTO while registering mfd cells
Subsystems (6)
Sasha Levin
maintainerPATCH 1/16 mfd: ti_am335x_tscadc: Use PLATFORM_DEVID_AUTO while registering mfd cells
From: Vignesh R <[email protected]>
[ Upstream commit b40ee006fe6a8a25093434e5d394128c356a48f3 ]
Use PLATFORM_DEVID_AUTO to number mfd cells while registering, so that different instances are uniquely identified. This is required in order to support registering of multiple instances of same ti_am335x_tscadc IP.
--- drivers/mfd/ti_am335x_tscadc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mfd/ti_am335x_tscadc.c +3 -2
@@ -279,8 +279,9 @@ static int ti_tscadc_probe(struct platform_device *pdev) cell->pdata_size =sizeof (tscadc); } - err =mfd_add_devices (&pdev->dev, pdev->id, tscadc->cells, - tscadc->used_cells,NULL ,0 ,NULL ); + err =mfd_add_devices (&pdev->dev,PLATFORM_DEVID_AUTO , + tscadc->cells, tscadc->used_cells,NULL , +0 ,NULL );if (err <0 ) goto err_disable_clk;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 2/16 mfd: twl-core: Fix section annotations on {,un}protect_pm_master
From: Nathan Chancellor <[email protected]>
[ Upstream commit 8838555089f0345b87f4277fe5a8dd647dc65589 ]
When building the kernel with Clang, the following section mismatch warning appears:
WARNING: vmlinux.o(.text+0x3d84a3b): Section mismatch in reference from the function twl_probe() to the function .init.text:unprotect_pm_master()
The function twl_probe() references
the function __init unprotect_pm_master().
This is often because twl_probe lacks a __init
annotation or the annotation of unprotect_pm_master is wrong.
Remove the __init annotation on the *protect_pm_master functions so there is no more mismatch.
--- drivers/mfd/twl-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/twl-core.c +2 -2
@@ -982,7 +982,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,* letting it generate the right frequencies for USB, MADC, and * other purposes. */ -static inline int __init protect_pm_master (void ) +static inline int protect_pm_master (void ) {int e =0 ;
@@ -991,7 +991,7 @@ static inline int __init protect_pm_master(void)return e; } -static inline int __init unprotect_pm_master (void ) +static inline int unprotect_pm_master (void ) {int e =0 ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 3/16 mfd: db8500-prcmu: Fix some section annotations
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit a3888f62fe66429fad3be7f2ba962e1e08c26fd6 ]
When building the kernel with Clang, the following section mismatch warnings appear:
WARNING: vmlinux.o(.text+0x7239cc): Section mismatch in reference from the function db8500_prcmu_probe() to the function .init.text:init_prcm_registers()
The function db8500_prcmu_probe() references
the function __init init_prcm_registers().
This is often because db8500_prcmu_probe lacks a __init annotation or the annotation of init_prcm_registers is wrong.
WARNING: vmlinux.o(.text+0x723e28): Section mismatch in reference from the function db8500_prcmu_probe() to the function .init.text:fw_project_name()
The function db8500_prcmu_probe() references
the function __init fw_project_name().
This is often because db8500_prcmu_probe lacks a __init annotation or the annotation of fw_project_name is wrong.
db8500_prcmu_probe should not be marked as __init so remove the __init annotation from fw_project_name and init_prcm_registers.
--- drivers/mfd/db8500-prcmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/db8500-prcmu.c +2 -2
@@ -2610,7 +2610,7 @@ static struct irq_chip prcmu_irq_chip = { .irq_unmask = prcmu_irq_unmask, }; -static __init char *fw_project_name (u32 project) +static char *fw_project_name (u32 project) {switch (project) {case PRCMU_FW_PROJECT_U8500 :
@@ -2758,7 +2758,7 @@ void __init db8500_prcmu_early_init(u32 phy_base, u32 size)INIT_WORK (&mb0_transfer.mask_work, prcmu_mask_work); } -static void __init init_prcm_registers (void ) +static void init_prcm_registers (void ) {u32 val;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 4/16 mfd: ab8500-core: Return zero in get_register_interruptible()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 10628e3ecf544fa2e4e24f8e112d95c37884dc98 ]
This function is supposed to return zero on success or negative error codes on error. Unfortunately, there is a bug so it sometimes returns non-zero, positive numbers on success.
I noticed this bug during review and I can't test it. It does appear that the return is sometimes propogated back to _regmap_read() where all non-zero returns are treated as failure so this may affect run time.
--- drivers/mfd/ab8500-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ab8500-core.c +1 -1
@@ -259,7 +259,7 @@ static int get_register_interruptible(struct ab8500 *ab8500, u8 bank,mutex_unlock (&ab8500->lock);dev_vdbg (ab8500->dev,"rd: addr %#x => data %#x\n" , addr, ret); -return ret; +return (ret <0 ) ? ret :0 ; } static int ab8500_get_register(struct device *dev, u8 bank,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 5/16 mfd: qcom_rpm: write fw_version to CTRL_REG
In reply to Sasha LevinFrom: Jonathan Marek <[email protected]>
[ Upstream commit 504e4175829c44328773b96ad9c538e4783a8d22 ]
This is required as part of the initialization sequence on certain SoCs.
If these registers are not initialized, the hardware can be unresponsive. This fixes the driver on apq8060 (HP TouchPad device).
--- drivers/mfd/qcom_rpm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mfd/qcom_rpm.c +4 -0
@@ -570,6 +570,10 @@ static int qcom_rpm_probe(struct platform_device *pdev)return -EFAULT ; } +writel (fw_version[0 ],RPM_CTRL_REG (rpm,0 )); +writel (fw_version[1 ],RPM_CTRL_REG (rpm,1 )); +writel (fw_version[2 ],RPM_CTRL_REG (rpm,2 )); +dev_info (&pdev->dev,"RPM firmware %u.%u.%u\n" , fw_version[0 ], fw_version[1 ], fw_version[2 ]);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 6/16 mfd: wm5110: Add missing ASRC rate register
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 04c801c18ded421845324255e660147a6f58dcd6 ]
--- drivers/mfd/wm5110-tables.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/wm5110-tables.c +2 -0
@@ -1622,6 +1622,7 @@ static const struct reg_default wm5110_reg_default[] = { { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ + { 0x00000EE3, 0x4000 }, /* R3811 - ASRC_RATE2 */ { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */
@@ -2877,6 +2878,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)case ARIZONA_ASRC_ENABLE :case ARIZONA_ASRC_STATUS :case ARIZONA_ASRC_RATE1 : +case ARIZONA_ASRC_RATE2 :case ARIZONA_ISRC_1_CTRL_1 :case ARIZONA_ISRC_1_CTRL_2 :case ARIZONA_ISRC_1_CTRL_3 :
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 7/16 mfd: mc13xxx: Fix a missing check of a register-read failure
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit 9e28989d41c0eab57ec0bb156617a8757406ff8a ]
When mc13xxx_reg_read() fails, "old_adc0" is uninitialized and will contain random value. Further execution uses "old_adc0" even when mc13xxx_reg_read() fails.
The fix checks the return value of mc13xxx_reg_read(), and exits the execution when it fails.
--- drivers/mfd/mc13xxx-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +3 -1
@@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, mc13xxx->adcflags |=MC13XXX_ADC_WORKING ; -mc13xxx_reg_read (mc13xxx,MC13XXX_ADC0 , &old_adc0); + ret =mc13xxx_reg_read (mc13xxx,MC13XXX_ADC0 , &old_adc0); +if (ret) + goto out; adc0 =MC13XXX_ADC0_ADINC1 |MC13XXX_ADC0_ADINC2 ; adc1 =MC13XXX_ADC1_ADEN |MC13XXX_ADC1_ADTRIGIGN |MC13XXX_ADC1_ASC ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 8/16 net: hns: Fix use after free identified by SLUB debug
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit bb989501abcafa0de5f18b0ec0ec459b5b817908 ]
When enable SLUB debug, than remove hns_enet_drv module, SLUB debug will identify a use after free bug:
[134.189505] Unable to handle kernel paging request at virtual address 006b6b6b6b6b6b6b [134.197553] Mem abort info: [134.200381] ESR = 0x96000004 [134.203487] Exception class = DABT (current EL), IL = 32 bits [134.209497] SET = 0, FnV = 0 [134.212596] EA = 0, S1PTW = 0 [134.215777] Data abort info: [134.218701] ISV = 0, ISS = 0x00000004 [134.222596] CM = 0, WnR = 0 [134.225606] [006b6b6b6b6b6b6b] address between user and kernel address ranges [134.232851] Internal error: Oops: 96000004 [#1] SMP [134.237798] CPU: 21 PID: 27834 Comm: rmmod Kdump: loaded Tainted: G OE 4.19.5-1.2.34.aarch64 #1 [134.247856] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.58 10/24/2018 [134.255181] pstate: 20000005 (nzCv daif -PAN -UAO) [134.260044] pc : hns_ae_put_handle+0x38/0x60 [134.264372] lr : hns_ae_put_handle+0x24/0x60 [134.268700] sp : ffff00001be93c50 [134.272054] x29: ffff00001be93c50 x28: ffff802faaec8040 [134.277442] x27: 0000000000000000 x26: 0000000000000000 [134.282830] x25: 0000000056000000 x24: 0000000000000015 [134.288284] x23: ffff0000096fe098 x22: ffff000001050070 [134.293671] x21: ffff801fb3c044a0 x20: ffff80afb75ec098 [134.303287] x19: ffff80afb75ec098 x18: 0000000000000000 [134.312945] x17: 0000000000000000 x16: 0000000000000000 [134.322517] x15: 0000000000000002 x14: 0000000000000000 [134.332030] x13: dead000000000100 x12: ffff7e02bea3c988 [134.341487] x11: ffff80affbee9e68 x10: 0000000000000000 [134.351033] x9 : 6fffff8000008101 x8 : 0000000000000000 [134.360569] x7 : dead000000000100 x6 : ffff000009579748 [134.370059] x5 : 0000000000210d00 x4 : 0000000000000000 [134.379550] x3 : 0000000000000001 x2 : 0000000000000000 [134.388813] x1 : 6b6b6b6b6b6b6b6b x0 : 0000000000000000 [134.397993] Process rmmod (pid: 27834, stack limit = 0x00000000d474b7fd) [134.408498] Call trace: [134.414611] hns_ae_put_handle+0x38/0x60 [134.422208] hnae_put_handle+0xd4/0x108 [134.429563] hns_nic_dev_remove+0x60/0xc0 [hns_enet_drv] [134.438342] platform_drv_remove+0x2c/0x70 [134.445958] device_release_driver_internal+0x174/0x208 [134.454810] driver_detach+0x70/0xd8 [134.461913] bus_remove_driver+0x64/0xe8 [134.469396] driver_unregister+0x34/0x60 [134.476822] platform_driver_unregister+0x20/0x30 [134.485130] hns_nic_dev_driver_exit+0x14/0x6e4 [hns_enet_drv] [134.494634] __arm64_sys_delete_module+0x238/0x290
struct hnae_handle is a member of struct hnae_vf_cb, so when vf_cb is freed, than use hnae_handle will cause use after free panic.
This patch frees vf_cb after hnae_handle used.
--- drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c +2 -4
@@ -188,12 +188,10 @@ static void hns_ae_put_handle(struct hnae_handle *handle)struct hnae_vf_cb *vf_cb =hns_ae_get_vf_cb (handle);int i; - vf_cb->mac_cb =NULL ; - -kfree (vf_cb); -for (i =0 ; i < handle->q_num; i++)hns_ae_get_ring_pair (handle->qs[i])->used_by_vf =0 ; + +kfree (vf_cb); }static void hns_ae_ring_enable_all (struct hnae_handle *handle,int val)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 9/16 MIPS: ath79: Enable OF serial ports in the default config
In reply to Sasha LevinFrom: Alban Bedel <[email protected]>
[ Upstream commit 565dc8a4f55e491935bfb04866068d21784ea9a4 ]
CONFIG_SERIAL_OF_PLATFORM is needed to get a working console on the OF boards, enable it in the default config to get a working setup out of the box.
--- arch/mips/configs/ath79_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/configs/ath79_defconfig +1 -0
@@ -74,6 +74,7 @@ CONFIG_SERIAL_8250_CONSOLE=y # CONFIG_SERIAL_8250_PCI is not set CONFIG_SERIAL_8250_NR_UARTS=1 CONFIG_SERIAL_8250_RUNTIME_UARTS=1 +CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIAL_AR933X=y CONFIG_SERIAL_AR933X_CONSOLE=y # CONFIG_HW_RANDOM is not set
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 10/16 scsi: qla4xxx: check return code of qla4xxx_copy_from_fwddb_param
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 72b4a0465f995175a2e22cf4a636bf781f1f28a7 ]
The return code should be check while qla4xxx_copy_from_fwddb_param fails.
--- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla4xxx/ql4_os.c +2 -0
@@ -7245,6 +7245,8 @@ static int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha, rc =qla4xxx_copy_from_fwddb_param (fnode_sess, fnode_conn, fw_ddb_entry); +if (rc) + goto free_sess;ql4_printk (KERN_INFO , ha,"%s: sysfs entry %s created\n" , __func__, fnode_sess->dev.kobj.name);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 11/16 scsi: isci: initialize shost fully before calling scsi_add_host()
In reply to Sasha LevinFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit cc29a1b0a3f2597ce887d339222fa85b9307706d ]
scsi_mq_setup_tags(), which is called by scsi_add_host(), calculates the command size to allocate based on the prot_capabilities. In the isci driver, scsi_host_set_prot() is called after scsi_add_host() so the command size gets calculated to be smaller than it needs to be. Eventually, scsi_mq_init_request() locates the 'prot_sdb' after the command assuming it was sized correctly and a buffer overrun may occur.
However, seeing blk_mq_alloc_rqs() rounds up to the nearest cache line size, the mistake can go unnoticed.
The bug was noticed after the struct request size was reduced by commit 9d037ad707ed ("block: remove req->timeout_list")
Which likely reduced the allocated space for the request by an entire cache line, enough that the overflow could be hit and it caused a panic, on boot, at:
RIP: 0010:t10_pi_complete+0x77/0x1c0
Call Trace:
<IRQ>
sd_done+0xf5/0x340
scsi_finish_command+0xc3/0x120
blk_done_softirq+0x83/0xb0
__do_softirq+0xa1/0x2e6
irq_exit+0xbc/0xd0
call_function_single_interrupt+0xf/0x20
</IRQ>sd_done() would call scsi_prot_sg_count() which reads the number of entities in 'prot_sdb', but seeing 'prot_sdb' is located after the end of the allocated space it reads a garbage number and erroneously calls t10_pi_complete().
To prevent this, the calls to scsi_host_set_prot() are moved into isci_host_alloc() before the call to scsi_add_host(). Out of caution, also move the similar call to scsi_host_set_guard().
--- drivers/scsi/isci/init.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/isci/init.c +7 -7
@@ -595,6 +595,13 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) shost->max_lun = ~0 ; shost->max_cmd_len =MAX_COMMAND_SIZE ; +/* turn on DIF support */ +scsi_host_set_prot (shost, +SHOST_DIF_TYPE1_PROTECTION | +SHOST_DIF_TYPE2_PROTECTION | +SHOST_DIF_TYPE3_PROTECTION ); +scsi_host_set_guard (shost,SHOST_DIX_GUARD_CRC ); + err =scsi_add_host (shost, &pdev->dev);if (err) goto err_shost;
@@ -682,13 +689,6 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_host_alloc; } pci_info->hosts[i] = h; - -/* turn on DIF support */ -scsi_host_set_prot (to_shost (h), -SHOST_DIF_TYPE1_PROTECTION | -SHOST_DIF_TYPE2_PROTECTION | -SHOST_DIF_TYPE3_PROTECTION ); -scsi_host_set_guard (to_shost (h),SHOST_DIX_GUARD_CRC ); } err =isci_setup_interrupts (pdev);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 12/16 MIPS: jazz: fix 64bit build
In reply to Sasha LevinFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit 41af167fbc0032f9d7562854f58114eaa9270336 ]
64bit JAZZ builds failed with
linux-next/arch/mips/jazz/jazzdma.c: In function vdma_init:
/linux-next/arch/mips/jazz/jazzdma.c:77:30: error: implicit declaration
of function `KSEG1ADDR`; did you mean `CKSEG1ADDR`?
[-Werror=implicit-function-declaration]
pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
^~~~~~~~~
CKSEG1ADDR
/linux-next/arch/mips/jazz/jazzdma.c:77:10: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
^
In file included from /linux-next/arch/mips/include/asm/barrier.h:11:0,
from /linux-next/include/linux/compiler.h:248,
from /linux-next/include/linux/kernel.h:10,
from /linux-next/arch/mips/jazz/jazzdma.c:11:
/linux-next/arch/mips/include/asm/addrspace.h:41:29: error: cast from
pointer to integer of different size [-Werror=pointer-to-int-cast]
#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
^
/linux-next/arch/mips/include/asm/addrspace.h:53:25: note: in
expansion of macro `_ACAST32_`
#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
^~~~~~~~~
/linux-next/arch/mips/jazz/jazzdma.c:84:44: note: in expansion of
macro `CPHYSADDR`
r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl));Using correct casts and CKSEG1ADDR when dealing with the pgtbl setup fixes this.
--- arch/mips/jazz/jazzdma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/jazz/jazzdma.c +3 -2
@@ -71,14 +71,15 @@ static int __init vdma_init(void) get_order(VDMA_PGTBL_SIZE));BUG_ON (!pgtbl);dma_cache_wback_inv ((unsigned long )pgtbl,VDMA_PGTBL_SIZE ); - pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR (pgtbl); + pgtbl = (VDMA_PGTBL_ENTRY *)CKSEG1ADDR ((unsigned long )pgtbl);/* * Clear the R4030 translation table */ vdma_pgtbl_init (); -r4030_write_reg32 (JAZZ_R4030_TRSTBL_BASE ,CPHYSADDR (pgtbl)); +r4030_write_reg32 (JAZZ_R4030_TRSTBL_BASE , +CPHYSADDR ((unsigned long )pgtbl));r4030_write_reg32 (JAZZ_R4030_TRSTBL_LIM ,VDMA_PGTBL_SIZE );r4030_write_reg32 (JAZZ_R4030_TRSTBL_INV ,0 );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 13/16 isdn: i4l: isdn_tty: Fix some concurrency double-free bugs
In reply to Sasha LevinFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 2ff33d6637393fe9348357285931811b76e1402f ]
The functions isdn_tty_tiocmset() and isdn_tty_set_termios() may be concurrently executed.
isdn_tty_tiocmset
isdn_tty_modem_hup
line 719: kfree(info->dtmf_state);
line 721: kfree(info->silence_state);
line 723: kfree(info->adpcms);
line 725: kfree(info->adpcmr);isdn_tty_set_termios
isdn_tty_modem_hup
line 719: kfree(info->dtmf_state);
line 721: kfree(info->silence_state);
line 723: kfree(info->adpcms);
line 725: kfree(info->adpcmr);Thus, some concurrency double-free bugs may occur.
These possible bugs are found by a static tool written by myself and my manual code review.
To fix these possible bugs, the mutex lock "modem_info_mutex" used in isdn_tty_tiocmset() is added in isdn_tty_set_termios().
--- drivers/isdn/i4l/isdn_tty.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/isdn/i4l/isdn_tty.c +5 -1
@@ -1459,15 +1459,19 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) {modem_info *info = (modem_info *) tty->driver_data; +mutex_lock (&modem_info_mutex);if (!old_termios)isdn_tty_change_speed (info);else {if (tty->termios.c_cflag == old_termios->c_cflag && tty->termios.c_ispeed == old_termios->c_ispeed && - tty->termios.c_ospeed == old_termios->c_ospeed) + tty->termios.c_ospeed == old_termios->c_ospeed) { +mutex_unlock (&modem_info_mutex);return ; + }isdn_tty_change_speed (info); } +mutex_unlock (&modem_info_mutex); }/*
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 14/16 atm: he: fix sign-extension overflow on large shift
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit cb12d72b27a6f41325ae23a11033cf5fedfa1b97 ]
Shifting the 1 by exp by an int can lead to sign-extension overlow when exp is 31 since 1 is an signed int and sign-extending this result to an unsigned long long will set the upper 32 bits. Fix this by shifting an unsigned long.
Detected by cppcheck:
(warning) Shifting signed 32-bit value by 31 bits is undefined behaviour
--- drivers/atm/he.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/atm/he.c +1 -1
@@ -717,7 +717,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev)instead of '/ 512', use '>> 9' to prevent a call to divdu3 on x86 platforms */ - rate_cps = (unsigned long long ) (1 << exp) * (man +512 ) >>9 ; + rate_cps = (unsigned long long ) (1UL << exp) * (man +512 ) >>9 ;if (rate_cps <10 ) rate_cps =10 ;/* 2.2.1 minimum payload rate is 10 cps */
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 15/16 leds: lp5523: fix a missing check of return value of lp55xx_read
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit 248b57015f35c94d4eae2fdd8c6febf5cd703900 ]
When lp55xx_read() fails, "status" is an uninitialized variable and thus may contain random value; using it leads to undefined behaviors.
The fix inserts a check for the return value of lp55xx_read: if it fails, returns with its error code.
--- drivers/leds/leds-lp5523.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-lp5523.c +3 -1
@@ -318,7 +318,9 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)/* Let the programs run for couple of ms and check the engine status */ usleep_range (3000 ,6000 ); -lp55xx_read (chip,LP5523_REG_STATUS , &status); + ret =lp55xx_read (chip,LP5523_REG_STATUS , &status); +if (ret) +return ret; status &=LP5523_ENG_STATUS_MASK ;if (status !=LP5523_ENG_STATUS_MASK ) {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 16/16 isdn: avm: Fix string plus integer warning from Clang
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 7afa81c55fca0cad589722cb4bce698b4803b0e1 ]
A recent commit in Clang expanded the -Wstring-plus-int warning, showing some odd behavior in this file.
drivers/isdn/hardware/avm/b1.c:426:30: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
cinfo->version[j] = "\0\0" + 1;
~~~~~~~^~~
drivers/isdn/hardware/avm/b1.c:426:30: note: use array indexing to silence this warning
cinfo->version[j] = "\0\0" + 1;
^
& [ ]1 warning generated.
This is equivalent to just "\0". Nick pointed out that it is smarter to use "" instead of "\0" because "" is used elsewhere in the kernel and can be deduplicated at the linking stage.
--- drivers/isdn/hardware/avm/b1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/hardware/avm/b1.c +1 -1
@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo)int i, j;for (j =0 ; j <AVM_MAXVERSION ; j++) - cinfo->version[j] ="\0\0" +1 ; + cinfo->version[j] ="" ;for (i =0 , j =0 ; j <AVM_MAXVERSION && i < cinfo->versionlen; j++, i += cinfo->versionbuf[i] +1 )
Signature · 1 line
2.19.1