flaw in hal_buffers.c in 18th release Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
dash
Posts: 17
Joined: Thu Oct 25, 2012 10:16 pm
Has thanked: 1 time
Been thanked: 4 times

flaw in hal_buffers.c in 18th release  Topic is solved

Postby dash » Sun Aug 12, 2018 10:29 pm

I found a flaw in hal_buffers.c that appeared in the 18th release.
OS crashes at ibqReadTimeout when kernel checks enabled.
The code looks like this

Code: Select all

deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);

but, streamRead calls ibqReadTimeout with TIME_INFINITE and osalTimeAddX can't pass the checks.

I made a very ugly solution

Code: Select all

  if (timeout != TIME_INFINITE)
    deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);


I do not understand how to do it beautifully.
Need to make it beautiful, because all the OS code is written beautifully.

It is very strange that no one has discovered this before. Surely no one uses the kernel checks?

PS
obqWriteTimeout has some flaw.

User avatar
Giovanni
Site Admin
Posts: 11385
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 430 times
Been thanked: 362 times
Contact:

Re: flaw in hal_buffers.c in 18th release

Postby Giovanni » Mon Aug 13, 2018 3:36 pm

Hi,

This has been fixed in trunk already, see bug #963. It will be released in 18.2.2.

Giovanni

faisal
Posts: 201
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 30 times
Been thanked: 25 times

Re: flaw in hal_buffers.c in 18th release

Postby faisal » Mon Aug 13, 2018 3:40 pm

Has something been added to the unit tests to catch this class of problem in the future before code is committed to the repository?

dash
Posts: 17
Joined: Thu Oct 25, 2012 10:16 pm
Has thanked: 1 time
Been thanked: 4 times

Re: flaw in hal_buffers.c in 18th release

Postby dash » Mon Aug 13, 2018 10:14 pm

aha... I realized my mistake. sf is the main repo, not github :)
thank you Giovanni

User avatar
Giovanni
Site Admin
Posts: 11385
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 430 times
Been thanked: 362 times
Contact:

Re: flaw in hal_buffers.c in 18th release

Postby Giovanni » Tue Aug 14, 2018 7:04 am

Hi,

HAL does not have unit tests implemented. only generic test//demo applications.

Only RT, NIL, OSLIB and NASA OSAL have those.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests