ARM: vexpress/spc: Avoid negative array index when !SMP
Subsystems (7)
Sasha Levin
maintainerPATCH 7/7 drm/msm/mdp5: check the return of kzalloc()
In reply to Sasha LevinFrom: Xiaoke Wang <[email protected]>
[ Upstream commit 047ae665577776b7feb11bd4f81f46627cff95e7 ]
kzalloc() is a memory allocation function which can return NULL when some internal memory errors happen. So it is better to check it to prevent potential wrong memory access.
Besides, since mdp5_plane_reset() is void type, so we should better set plane-state to NULL after releasing it.
Patchwork: https://patchwork.freedesktop.org/patch/481055/
--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +3 -0
@@ -192,7 +192,10 @@ static void mdp5_plane_reset(struct drm_plane *plane)drm_framebuffer_unreference (plane->state->fb);kfree (to_mdp5_plane_state (plane->state)); + plane->state =NULL ; mdp5_state =kzalloc (sizeof (*mdp5_state),GFP_KERNEL ); +if (!mdp5_state) +return ;/* assign default blend parameters */ mdp5_state->alpha =255 ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/7 ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit 1ef8715975de8bd481abbd0839ed4f49d9e5b0ff ]
Fix:
sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’:
sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constant
case USB_ID(0xfc08, 0x0101): /* Unknown vendor Cable */
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
[ A slight correction with parentheses around the argument by tiwai ]
--- sound/usb/usbaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/usbaudio.h +1 -1
@@ -22,7 +22,7 @@*/ /* handling of USB vendor/product ID pairs as 32-bit numbers */ -#define USB_ID (vendor, product) (((vendor) << 16) | (product)) +#define USB_ID (vendor, product) (((unsigned int)(vendor) << 16) | (product))#define USB_ID_VENDOR (id) ((id) >> 16)#define USB_ID_PRODUCT (id) ((u16)(id))
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/7 brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit 6fb3a5868b2117611f41e421e10e6a8c2a13039a ]
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17):
^~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13):
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -1
@@ -547,7 +547,7 @@ enum brcmf_sdio_frmtype { BRCMF_SDIO_FT_SUB, }; -#define SDIOD_DRVSTR_KEY (chip, pmu) (((chip) << 16) | (pmu)) +#define SDIOD_DRVSTR_KEY (chip, pmu) (((unsigned int)(chip) << 16) | (pmu))/* SDIO Pad drive strength to select value mappings */ struct sdiod_drive_str {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/7 cifs: Check the IOCB_DIRECT flag, not O_DIRECT
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 994fd530a512597ffcd713b0f6d5bc916c5698f0 ]
Use the IOCB_DIRECT indicator flag on the I/O context rather than checking to see if the file was opened O_DIRECT.
--- fs/cifs/cifsfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.c +1 -1
@@ -766,7 +766,7 @@ cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter)ssize_t rc;struct inode *inode =file_inode (iocb->ki_filp); -if (iocb->ki_filp->f_flags &O_DIRECT ) +if (iocb->ki_flags &IOCB_DIRECT )return cifs_user_readv (iocb, iter); rc =cifs_revalidate_mapping (inode);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/7 vxlan: fix error return code in vxlan_fdb_append
In reply to Sasha LevinFrom: Hongbin Wang <[email protected]>
[ Upstream commit 7cea5560bf656b84f9ed01c0cc829d4eecd0640b ]
When kmalloc and dst_cache_init failed, should return ENOMEM rather than ENOBUFS.
--- drivers/net/vxlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vxlan.c +2 -2
@@ -490,11 +490,11 @@ static int vxlan_fdb_append(struct vxlan_fdb *f, rd =kmalloc (sizeof (*rd),GFP_ATOMIC );if (rd ==NULL ) -return -ENOBUFS ; +return -ENOMEM ;if (dst_cache_init (&rd->dst_cache,GFP_ATOMIC )) {kfree (rd); -return -ENOBUFS ; +return -ENOMEM ; } rd->remote_ip = *ip;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/7 platform/x86: samsung-laptop: Fix an unsigned comparison which can never be negative
In reply to Sasha LevinFrom: Jiapeng Chong <[email protected]>
[ Upstream commit 0284d4d1be753f648f28b77bdfbe6a959212af5c ]
Eliminate the follow smatch warnings:
drivers/platform/x86/samsung-laptop.c:1124 kbd_led_set() warn: unsigned 'value' is never less than zero.
--- drivers/platform/x86/samsung-laptop.c | 2 -- 1 file changed, 2 deletions(-)
drivers/platform/x86/samsung-laptop.c +0 -2
@@ -1125,8 +1125,6 @@ static void kbd_led_set(struct led_classdev *led_cdev,if (value > samsung->kbd_led.max_brightness) value = samsung->kbd_led.max_brightness; -else if (value <0 ) - value =0 ; samsung->kbd_led_wk = value;queue_work (samsung->led_workqueue, &samsung->kbd_led_work);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 1/7 ARM: vexpress/spc: Avoid negative array index when !SMP
From: Kees Cook <[email protected]>
[ Upstream commit b3f1dd52c991d79118f35e6d1bf4d7cb09882e38 ]
When building multi_v7_defconfig+CONFIG_SMP=n, -Warray-bounds exposes a couple negative array index accesses:
arch/arm/mach-vexpress/spc.c: In function 've_spc_clk_init':arch/arm/mach-vexpress/spc.c:583:21: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds]
583 | if (init_opp_table[cluster])
| ~~~~~~~~~~~~~~^~~~~~~~~
arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table'
556 | bool init_opp_table[MAX_CLUSTERS] = { false };
| ^~~~~~~~~~~~~~
arch/arm/mach-vexpress/spc.c:592:18: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds]
592 | init_opp_table[cluster] = true;
| ~~~~~~~~~~~~~~^~~~~~~~~
arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table'
556 | bool init_opp_table[MAX_CLUSTERS] = { false };
| ^~~~~~~~~~~~~~Skip this logic when built !SMP.
--- arch/arm/mach-vexpress/spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-vexpress/spc.c +1 -1
@@ -584,7 +584,7 @@ static int __init ve_spc_clk_init(void) } cluster =topology_physical_package_id (cpu_dev->id); -if (init_opp_table[cluster]) +if (cluster <0 || init_opp_table[cluster])continue ;if (ve_init_opp_table (cpu_dev))
Signature · 1 line
2.35.1