Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free space calculations work for anything less than 4G but will fail for anything above 4G #1290

Closed
lhoge opened this issue Sep 22, 2022 · 1 comment

Comments

@lhoge
Copy link

lhoge commented Sep 22, 2022

On PACE we noticed the upper bits of the free space entry jumping.

The bug is in the function OS_fsBytesFree in the file osal/src/os/vxworks6
The function has the following line
bytes_free_local = stat_buf.f_bfree * stat_buf.f_bsize;
where bytes_free_local is a uint64 and the bfree and bsize are 32 bit numbers. When the result of the multiplication is a number greater than 0xFFFF FFFF, bytes_free_local gives an incorrect result, where lower 32 bits are correct but upper 32 bits is set to 0xFFFFFFFF

The line was modified as follows to give the right results when bytes_free_local is greater than 4GBytes
bytes_free_local = (uint64)((uint64)(stat_buf.f_bfree) * (uint64)(stat_buf.f_bsize));

@skliper
Copy link
Contributor

skliper commented Sep 22, 2022

OS_fsBytesFree was deprecated in #759 due in part to this issue. Glad you fixed for your use but issue doesn't apply to the current code base. Duplicate of #718.

@skliper skliper closed this as completed Sep 22, 2022
@dmknutsen dmknutsen added this to the Draco milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants