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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48ad36dc-613f-401f-a8e2-dec832bd6ee1@microchip.com>
Date: Mon, 24 Nov 2025 15:00:55 +0000
From: Prajna Rajendra Kumar <prajna.rajendrakumar@...rochip.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Mark Brown <broonie@...nel.org>, Conor Dooley
	<conor.dooley@...rochip.com>, <linux-spi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH next v2] spi: Fix potential uninitialized variable in
 probe()

On 24/11/2025 07:56, Dan Carpenter wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> If the device tree is messed up, then potentially the "protocol" string
> could potentially be uninitialized.  The property is supposed to default
> to "motorola" so if the of_property_read_string() function returns
> -EINVAL then default to "motorola".
>
> Fixes: 059f545832be ("spi: add support for microchip "soft" spi controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Reviewed-by: Prajna Rajendra Kumar <prajna.rajendrakumar@...rochip.com>
> ---
> v2: Add an error message on failure.
>      Default to "motorola".
>
>   drivers/spi/spi-microchip-core-spi.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-microchip-core-spi.c b/drivers/spi/spi-microchip-core-spi.c
> index b8738190cdcb..16e0885474a0 100644
> --- a/drivers/spi/spi-microchip-core-spi.c
> +++ b/drivers/spi/spi-microchip-core-spi.c
> @@ -295,10 +295,10 @@ static int mchp_corespi_transfer_one(struct spi_controller *host,
>
>   static int mchp_corespi_probe(struct platform_device *pdev)
>   {
> +       const char *protocol = "motorola";
>          struct spi_controller *host;
>          struct mchp_corespi *spi;
>          struct resource *res;
> -       const char *protocol;
>          u32 num_cs, mode, frame_size;
>          bool assert_ssel;
>          int ret = 0;
> @@ -320,6 +320,8 @@ static int mchp_corespi_probe(struct platform_device *pdev)
>           */
>          ret = of_property_read_string(pdev->dev.of_node, "microchip,protocol-configuration",
>                                        &protocol);
> +       if (ret && ret != -EINVAL)
> +               return dev_err_probe(&pdev->dev, ret, "Error reading protocol-configuration\n");
>          if (strcmp(protocol, "motorola") != 0)
>                  return dev_err_probe(&pdev->dev, -EINVAL,
>                                       "CoreSPI: protocol '%s' not supported by this driver\n",
> --
> 2.51.0
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ