2023-06-16 22:32:18

by Mark Brown

[permalink] [raw]
Subject: Re: [BUG] _regmap_raw_write() - divide-by-zero

On Fri, Jun 16, 2023 at 02:58:24PM -0700, Russ Weight wrote:

> The origination of the regmap->max_raw_write value is here:
> https://github.com/torvalds/linux/blob/4973ca29552864a7a047ab8a15611a585827412f/drivers/base/regmap/regmap-spi-avmm.c#L663
> > .max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,

> SPI_AVMM_VAL_SIZE is defined as 4, and MAX_WRITE_CNT is defined as 1

This should add in some headroom for the value too.

We should also fix the max_raw_write comments since it's a bit confusing
between users and buses, though AFAICT nothing outside the core ever
checks.


Attachments:
(No filename) (594.00 B)
signature.asc (499.00 B)
Download all attachments

2023-06-16 22:44:02

by Jim Wylder

[permalink] [raw]
Subject: Re: [BUG] _regmap_raw_write() - divide-by-zero

Sorry for causing the grief.

For the description would it be something like "Max transfer size
supported on a write"?
Or does that still not describe it correctly?

Jim

On Fri, Jun 16, 2023 at 5:14 PM Mark Brown <[email protected]> wrote:
>
> On Fri, Jun 16, 2023 at 02:58:24PM -0700, Russ Weight wrote:
>
> > The origination of the regmap->max_raw_write value is here:
> > https://github.com/torvalds/linux/blob/4973ca29552864a7a047ab8a15611a585827412f/drivers/base/regmap/regmap-spi-avmm.c#L663
> > > .max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
>
> > SPI_AVMM_VAL_SIZE is defined as 4, and MAX_WRITE_CNT is defined as 1
>
> This should add in some headroom for the value too.
>
> We should also fix the max_raw_write comments since it's a bit confusing
> between users and buses, though AFAICT nothing outside the core ever
> checks.

2023-06-16 23:25:15

by Russ Weight

[permalink] [raw]
Subject: Re: [BUG] _regmap_raw_write() - divide-by-zero



On 6/16/23 15:14, Mark Brown wrote:
> On Fri, Jun 16, 2023 at 02:58:24PM -0700, Russ Weight wrote:
>
>> The origination of the regmap->max_raw_write value is here:
>> https://github.com/torvalds/linux/blob/4973ca29552864a7a047ab8a15611a585827412f/drivers/base/regmap/regmap-spi-avmm.c#L663
>>> .max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
>> SPI_AVMM_VAL_SIZE is defined as 4, and MAX_WRITE_CNT is defined as 1
> This should add in some headroom for the value too.

Thanks for the guidance, Mark. We'll put a patch together to fix up the config.

- Russ

>
> We should also fix the max_raw_write comments since it's a bit confusing
> between users and buses, though AFAICT nothing outside the core ever
> checks.


2023-06-17 12:28:58

by Mark Brown

[permalink] [raw]
Subject: Re: [BUG] _regmap_raw_write() - divide-by-zero

On Fri, Jun 16, 2023 at 05:39:05PM -0500, Jim Wylder wrote:

Please don't top post, reply in line with needed context. This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> Sorry for causing the grief.
>
> For the description would it be something like "Max transfer size
> supported on a write"?
> Or does that still not describe it correctly?

I'd probably specifically say it's the physical size but otherwise yes,
something like that.


Attachments:
(No filename) (586.00 B)
signature.asc (499.00 B)
Download all attachments