[PATCH 02/15] nand: Don't dereference NULL manufacturer_desc

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Sun Oct 29 14:06:33 CET 2023


Hi

On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson <seanga2 at gmail.com> wrote:
>
> When no manufacturer is matched, manufacturer_desc is NULL. Avoid
> dereferencing it in that case.
>
> Fixes: 4e67c571252 ("mtd,ubi,ubifs: sync with linux v3.15")
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
>
>  drivers/mtd/nand/raw/nand_base.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 6b4adcf6bdc..44b6cb63a01 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4462,17 +4462,14 @@ ident_done:
>         else if (chip->jedec_version)
>                 pr_info("%s %s\n", manufacturer_desc->name,
>                         chip->jedec_params.model);
> -       else
> +       else if (manufacturer_desc)
>                 pr_info("%s %s\n", manufacturer_desc->name, type->name);
>  #else
>         if (chip->jedec_version)
>                 pr_info("%s %s\n", manufacturer_desc->name,
>                         chip->jedec_params.model);
> -       else
> +       else if (manufacturer_desc)
>                 pr_info("%s %s\n", manufacturer_desc->name, type->name);
> -
> -       pr_info("%s %s\n", manufacturer_desc->name,
> -               type->name);
>  #endif
>
>         pr_info("%d MiB, %s, erase size: %d KiB, page size: %d, OOB size: %d\n",
> --
> 2.37.1
>

Reviewed-by: Michael Trimarchi <michael at amarulasolutions.com>


-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com


More information about the U-Boot mailing list