lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 18 May 2023 16:06:13 -0700
From:   Markus Mayer <mmayer@...adcom.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc:     Broadcom internal kernel review list 
        <bcm-kernel-feedback-list@...adcom.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memory: brcmstb_dpfe: fix testing array offset after use

On Sat, 13 May 2023 at 04:29, Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org> wrote:
>
> 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: 2f330caff577 ("memory: brcmstb: Add driver for DPFE")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> ---
>  drivers/memory/brcmstb_dpfe.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c
> index 76c82e9c8fce..9339f80b21c5 100644
> --- a/drivers/memory/brcmstb_dpfe.c
> +++ b/drivers/memory/brcmstb_dpfe.c
> @@ -434,15 +434,17 @@ static void __finalize_command(struct brcmstb_dpfe_priv *priv)
>  static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd,
>                           u32 result[])
>  {
> -       const u32 *msg = priv->dpfe_api->command[cmd];
>         void __iomem *regs = priv->regs;
>         unsigned int i, chksum, chksum_idx;
> +       const u32 *msg;
>         int ret = 0;
>         u32 resp;
>
>         if (cmd >= DPFE_CMD_MAX)
>                 return -1;
>
> +       msg = priv->dpfe_api->command[cmd];
> +
>         mutex_lock(&priv->lock);
>
>         /* Wait for DCPU to become ready */
> --
> 2.34.1
>

Acked-by: Markus Mayer <mmayer@...adcom.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ