Re: [PATCH] staging: axis-fifo: initialize timeouts in probe only

From: Fabio M. De Francesco
Date: Tue Mar 14 2023 - 15:07:19 EST


On martedì 14 marzo 2023 16:13:53 CET Alison Schofield wrote:
> On Tue, Mar 14, 2023 at 07:42:07AM -0700, Nathan Chancellor wrote:
> > Hi Khadija,
> >
> > On Tue, Mar 14, 2023 at 07:08:31PM +0500, Khadija Kamran wrote:
> > > On Tue, Mar 14, 2023 at 11:45:51AM +0800, kernel test robot wrote:
> > > >
> > > > [...]
> > >
> > > Hi everyone!
> > > Kindly let me know if I should look into these warnings.
> > > Thank you!
> >
> > You should always avoid introducing new warnings whenever possible. In
> > this case, it appears that read_timeout and write_timeout should be
> > changed from 'int' to 'long' to account for the fact that
> > MAX_SCHEDULE_TIMEOUT is being assigned to it directly now, versus being
> > passed as a parameter to wait_event_interruptible_timeout(), which
> > assigned it to 'long' anyways.
> >
> > If you have any other questions or need further help, let me know :)
> >
> > Cheers,
> > Nathan
>
> Hi Khadija,
>
> Echoing Nathan's feedback - yes, you need to correct these.
>
> Do you see these warnings when you compiled? If yes, then your path to
> fixing them is easier. Make sure it recompiles with no warnings.
>
> If you don't see these warnings, then you need to follow the steps to
> reproduce in the lkp email. You have to be able to 'see the warning'
> make a change and 'see it go away'.
>
> Alison
>

Hi Khadija,

I would suggest trying to recompile using "make W=1 -j...". Not sure if you'll
see the warnings (depends on your compiler, version and target architecture).
However, it's worth a try as it may save you the time it takes to go through
the steps for reproduction.

Anyway, as Nathan said, that warning is triggered by assigning 'long' to 'int'
(i.e., "MAX_SCHEDULE_TIMEOUT" is cast to 'long', while the types of
"read_timeout" and "write_timeout " are both 'int'). Obviously, these kinds of
assignments overflow wherever the representation of type 'long' uses more bits
than the type 'int'.

That implies that you should try to understand where the module's parameters
are defined and how to work with the related macros.

I hope it helps.

Fabio

P.S.: If you don't know yet what to do, take a look at the following document:
https://sysprog21.github.io/lkmpg/ (The Linux Kernel Module Programming
Guide).