openocd
openocd copied to clipboard
Calloc warning/error
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));
That sounds like a problem in the upstream OpenOCD code, rather than anything that Raspberry Pi have modified?
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.
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?
Looks like this is still applicable to our latest
sdk-2.0.0branch 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
As a workaround for this,
export CFLAGS="-Wno-error=calloc-transposed-args"
./configure