[Skiboot] [PATCH 2/2] hdata/vpd: Remove possible dereference after null check (CID 207468)

Oliver oohall at gmail.com
Wed Jan 17 16:20:51 AEDT 2018


On Mon, Jan 15, 2018 at 4:18 PM, Cyril Bur <cyril.bur at au1.ibm.com> wrote:
> The next_extry label doesn't do anything other than perform an addition
> which requires a dereference of the NULL entry variable, just continue
> the loop instead.
>
> Fixes: 77190aa7 (hdata/vpd: Rework vpd node creation logic)
> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> ---
>  hdata/vpd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hdata/vpd.c b/hdata/vpd.c
> index d114e6b7..3eb7dcf2 100644
> --- a/hdata/vpd.c
> +++ b/hdata/vpd.c
> @@ -400,7 +400,7 @@ void dt_init_vpd_node(void)
>                 /* Get SLCA entry */
>                 entry = slca_get_entry(index);
>                 if (!entry)
> -                       goto next_entry;
> +                       continue;

<bikeshed>

WELL GIVEN THIS CAN ONLY HAPPEN IF WE GET AN OUT OF RANGE SLCA INDEX
IT DOESN'T REALLY MAKE ANY SENSE TO CONTINUE HERE. THIS SHOULD
PROBABLY BE A BREAK INSTEAD.

</bikeshed>

>
>                 /*
>                  * A child entry is valid if all of the following criteria is met
> --
> 2.15.1
>


More information about the Skiboot mailing list