Control: forwarded -1 https://github.com/stlink-org/stlink/issues/1365
Control: tags -1 + fixed-upstream
On Wed, Jul 03, 2024 at 12:45:01PM +0000, Matthias Klose wrote:
> /<<PKGBUILDDIR>>/src/stlink-lib/chipid.c:68:22: error: ‘calloc’ sizes
> specified with ‘sizeof’ in the earlier argument and not in the later argument
> [-Werror=calloc-transposed-args]
> 68 | ts = calloc(sizeof(struct stlink_chipid_params), 1);
> | ^~~~~~
> /<<PKGBUILDDIR>>/src/stlink-lib/chipid.c:68:22: note: earlier argument should
> specify number of elements, later size of each element
> /<<PKGBUILDDIR>>/src/stlink-lib/chipid.c: In function ‘process_chipfile’:
> /<<PKGBUILDDIR>>/src/stlink-lib/chipid.c:68:22: error: ‘calloc’ sizes
> specified with ‘sizeof’ in the earlier argument and not in the later argument
> [-Werror=calloc-transposed-args]
> 68 | ts = calloc(sizeof(struct stlink_chipid_params), 1);
> | ^~~~~~
> /<<PKGBUILDDIR>>/src/stlink-lib/chipid.c:68:22: note: earlier argument should
> specify number of elements, later size of each element
This is fixed upstream as part of commit
6a6718b3342b6c5e282a4e33325b9f97908a0692, and is effectively this
one-liner:
--- a/src/stlink-lib/chipid.c
+++ b/src/stlink-lib/chipid.c
@@ -65,7 +65,7 @@ void process_chipfile(char *fname) {
return;
}
- ts = calloc(sizeof(struct stlink_chipid_params), 1);
+ ts = calloc(1, sizeof(struct stlink_chipid_params));
while (fgets(buf, sizeof(buf), fp) != NULL) {
Faidon