[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YyW95IoDkZl70V4a@fedora>
Date: Sat, 17 Sep 2022 08:30:28 -0400
From: William Breathitt Gray <william.gray@...aro.org>
To: linux-iio@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, mranostay@...com,
jpanis@...libre.com, gwendal@...omium.org, bleung@...omium.org,
groeck@...omium.org, jic23@...nel.org, david@...hnology.com,
robertcnelson@...il.com
Subject: Re: [PATCH v2 4/4] counter: Introduce the COUNTER_COMP_ARRAY
component type
On Fri, Sep 16, 2022 at 08:39:28PM -0400, William Breathitt Gray wrote:
> +static int counter_array_attrs_create(struct device *const dev,
> + struct counter_attribute_group *const group,
> + const struct counter_comp *const comp,
> + const enum counter_scope scope,
> + void *const parent, const size_t id)
> +{
> + const struct counter_array *const array = comp->priv;
> + struct counter_comp ext = *comp;
> + struct counter_array *element;
> + size_t idx;
> + int err;
> +
> + /* Create an attribute for each array element */
> + for (idx = 0; idx < array->length; idx++) {
> + /* Set index for array element extension */
> + element = ext.priv;
> + element->idx = idx;
This is unintentionally overwriting the array length and thus skipping
the subsequent array elements. Instead, element should be a copy of the
array rather than a pointer to it. I'll fix this in a v3 release.
William Breathitt Gray
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists