Re: [PATCH v2 4/4] counter: Introduce the COUNTER_COMP_ARRAY component type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux