Hyunjung Ko <[email protected]> writes:
> papr_scm_probe() reads "ibm,metadata-size" into metadata_size without
> checking the return value, and the property is optional, as the comment
> right above the call says. of_property_read_u32() only writes the output
> when it can decode a value, so for a device tree without that property
> p->metadata_size is set from an uninitialised stack value.
>
> p->metadata_size is the bound for the metadata get/set commands:
>
> if ((hdr->in_offset + hdr->in_length) > p->metadata_size)
>
> so a garbage value decides which metadata accesses are accepted.
> Initialise it to zero, which makes those commands reject every access
> when the platform does not advertise a metadata area.
>
> Signed-off-by: Hyunjung Ko <[email protected]>
> Cc: [email protected]
Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")
With that LGTM, feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>