Re: [PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-06 Thread Jonathan Cameron
On Tue, 2 Mar 2021 23:56:46 +0900 William Breathitt Gray wrote: > On Tue, Mar 02, 2021 at 03:43:55PM +0100, Fabrice Gasnier wrote: > > The ceiling value isn't checked before writing it into registers. The user > > could write a value higher than the counter resolution (e.g. 16 or 32 bits > > indi

Re: [PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-03 Thread Fabrice Gasnier
On 3/3/21 12:42 AM, William Breathitt Gray wrote: > On Tue, Mar 02, 2021 at 06:03:25PM +0100, Fabrice Gasnier wrote: >> On 3/2/21 3:56 PM, William Breathitt Gray wrote: >>> Side question: if priv->ceiling is tracking the current ceiling >>> configuration, would it make sense to change stm32_count_c

Re: [PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-03 Thread William Breathitt Gray
On Tue, Mar 02, 2021 at 06:03:25PM +0100, Fabrice Gasnier wrote: > On 3/2/21 3:56 PM, William Breathitt Gray wrote: > > Side question: if priv->ceiling is tracking the current ceiling > > configuration, would it make sense to change stm32_count_ceiling_read() > > to print the value of priv->ceiling

Re: [PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-02 Thread Fabrice Gasnier
On 3/2/21 3:56 PM, William Breathitt Gray wrote: > On Tue, Mar 02, 2021 at 03:43:55PM +0100, Fabrice Gasnier wrote: >> The ceiling value isn't checked before writing it into registers. The user >> could write a value higher than the counter resolution (e.g. 16 or 32 bits >> indicated by max_arr). T

Re: [PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-02 Thread William Breathitt Gray
On Tue, Mar 02, 2021 at 03:43:55PM +0100, Fabrice Gasnier wrote: > The ceiling value isn't checked before writing it into registers. The user > could write a value higher than the counter resolution (e.g. 16 or 32 bits > indicated by max_arr). This makes most significant bits to be truncated. > Fix

[PATCH] counter: stm32-timer-cnt: fix ceiling write max value

2021-03-02 Thread Fabrice Gasnier
The ceiling value isn't checked before writing it into registers. The user could write a value higher than the counter resolution (e.g. 16 or 32 bits indicated by max_arr). This makes most significant bits to be truncated. Fix it by checking the max_arr to report a range error [1] to the user. Fix