Re: [PATCH 2/3] firmware: arm_scmi: Fix SENSOR_AXIS_NAME_GET behaviour when unsupported

From: Cristian Marussi
Date: Wed Jun 08 2022 - 12:27:00 EST


On Wed, Jun 08, 2022 at 05:19:02PM +0200, Peter Hilber wrote:
> Hi Cristian,
>
> I think I found two missing endianness conversions, see below.
>
> Best regards,
>
> Peter

[snip]

> > @@ -393,12 +398,14 @@ iter_axes_desc_process_response(const struct scmi_protocol_handle *ph,
> > u32 attrh, attrl;
> > struct scmi_sensor_axis_info *a;
> > size_t dsize = SCMI_MSG_RESP_AXIS_DESCR_BASE_SZ;
> > - struct scmi_sensor_info *s = priv;
> > + struct scmi_apriv *apriv = priv;
> > const struct scmi_axis_descriptor *adesc = st->priv;
> >
> > attrl = le32_to_cpu(adesc->attributes_low);
> > + if (SUPPORTS_EXTENDED_AXIS_NAMES(attrl))
> > + apriv->any_axes_support_extended_names = true;
> >
> > - a = &s->axis[st->desc_index + st->loop_idx];
> > + a = &apriv->s->axis[st->desc_index + st->loop_idx];
> > a->id = le32_to_cpu(adesc->id);
> > a->extended_attrs = SUPPORTS_EXTEND_ATTRS(attrl);
> >
> > @@ -444,10 +451,18 @@ iter_axes_extended_name_process_response(const struct scmi_protocol_handle *ph,
> > void *priv)
> > {
> > struct scmi_sensor_axis_info *a;
> > - const struct scmi_sensor_info *s = priv;
> > + const struct scmi_apriv *apriv = priv;
> > struct scmi_sensor_axis_name_descriptor *adesc = st->priv;
> >
> > - a = &s->axis[st->desc_index + st->loop_idx];
> > + if (adesc->axis_id >= st->max_resources)
>
> I think adesc->axis_id uses in this function need to be wrapped with
> le32_to_cpu() (here and below as well).
>

...damn, my bad ... I'm posting a V2.

Thanks for the review !

Cristian