mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
memory: brcmstb_dpfe: fix testing array offset after use
[ Upstream commit1d9e93fad5
] Code should first check for valid value of array offset, then use it as the index. Fixes smatch warning: drivers/memory/brcmstb_dpfe.c:443 __send_command() error: testing array offset 'cmd' after use. Fixes:2f330caff5
("memory: brcmstb: Add driver for DPFE") Acked-by: Markus Mayer <mmayer@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://lore.kernel.org/r/20230513112931.176066-1-krzysztof.kozlowski@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f54142ed16
commit
b54bac970b
@ -398,15 +398,17 @@ static void __finalize_command(struct private_data *priv)
|
|||||||
static int __send_command(struct private_data *priv, unsigned int cmd,
|
static int __send_command(struct private_data *priv, unsigned int cmd,
|
||||||
u32 result[])
|
u32 result[])
|
||||||
{
|
{
|
||||||
const u32 *msg = priv->dpfe_api->command[cmd];
|
|
||||||
void __iomem *regs = priv->regs;
|
void __iomem *regs = priv->regs;
|
||||||
unsigned int i, chksum, chksum_idx;
|
unsigned int i, chksum, chksum_idx;
|
||||||
|
const u32 *msg;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u32 resp;
|
u32 resp;
|
||||||
|
|
||||||
if (cmd >= DPFE_CMD_MAX)
|
if (cmd >= DPFE_CMD_MAX)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
msg = priv->dpfe_api->command[cmd];
|
||||||
|
|
||||||
mutex_lock(&priv->lock);
|
mutex_lock(&priv->lock);
|
||||||
|
|
||||||
/* Wait for DCPU to become ready */
|
/* Wait for DCPU to become ready */
|
||||||
|
Loading…
Reference in New Issue
Block a user