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

Calloc warning/error #101

Open
R055A opened this issue Jul 17, 2024 · 4 comments · May be fixed by #102
Open

Calloc warning/error #101

R055A opened this issue Jul 17, 2024 · 4 comments · May be fixed by #102

Comments

@R055A
Copy link

R055A commented Jul 17, 2024

There is a calloc warning/error returned from line 1476 in src/jtag/drivers/ulink.c:

tdo_buffer_start = calloc(sizeof(uint8_t), scan_size_bytes);

The error causes a warning message but this can and is treated as an error, as follows:

Error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument`

A suggested fix is:

tdo_buffer_start = calloc(scan_size_bytes, sizeof(uint8_t));
@R055A R055A linked a pull request Jul 17, 2024 that will close this issue
@R055A R055A changed the title Calloc error Calloc error (although causes a warning, can and is treated as an error) Jul 17, 2024
@R055A R055A changed the title Calloc error (although causes a warning, can and is treated as an error) Calloc error (although a warning, can and is treated as an error) Jul 17, 2024
@R055A R055A changed the title Calloc error (although a warning, can and is treated as an error) Calloc warning/error Jul 17, 2024
@lurch
Copy link

lurch commented Jul 18, 2024

That sounds like a problem in the upstream OpenOCD code, rather than anything that Raspberry Pi have modified?

@R055A
Copy link
Author

R055A commented Jul 18, 2024

That sounds like a problem in the upstream OpenOCD code, rather than anything that Raspberry Pi have modified?

Hi @lurch

Thank you for the quick response.

I understand. I see it is already fixed a month ago here. However, not before the latest version was released in January 2023.

@lurch
Copy link

lurch commented Aug 24, 2024

Looks like this is still applicable to our latest sdk-2.0.0 branch https://github.com/raspberrypi/openocd/blob/sdk-2.0.0/src/jtag/drivers/ulink.c#L1476 . I dunno if it'll get merged or not (it seems unlikely we'd pull in a fix for a 3rd-party driver), but I guess you probably want to change the base-branch on your PR?

@R055A
Copy link
Author

R055A commented Aug 26, 2024

Looks like this is still applicable to our latest sdk-2.0.0 branch https://github.com/raspberrypi/openocd/blob/sdk-2.0.0/src/jtag/drivers/ulink.c#L1476 . I dunno if it'll get merged or not (it seems unlikely we'd pull in a fix for a 3rd-party driver), but I guess you probably want to change the base-branch on your PR?

Base branch is changed. Thank you @lurch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants