diff --git a/pkgs/development/tools/misc/stlink/calloc-argument-order.patch b/pkgs/development/tools/misc/stlink/calloc-argument-order.patch new file mode 100644 index 00000000000000..2370736ad58501 --- /dev/null +++ b/pkgs/development/tools/misc/stlink/calloc-argument-order.patch @@ -0,0 +1,25 @@ +From 7781732b0e09104d19c1f8476f1851760f4fa5fa Mon Sep 17 00:00:00 2001 +From: Jan Philipp Tebernum +Date: Sat, 28 Dec 2024 01:59:20 +0100 +Subject: [PATCH] fix: correct argument order for calloc + +--- + src/stlink-lib/chipid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/stlink-lib/chipid.c b/src/stlink-lib/chipid.c +index c115089..0a6a4e9 100644 +--- 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) { + +-- +2.47.0 + diff --git a/pkgs/development/tools/misc/stlink/default.nix b/pkgs/development/tools/misc/stlink/default.nix index 27e5437d9517fc..af14b25f42b812 100644 --- a/pkgs/development/tools/misc/stlink/default.nix +++ b/pkgs/development/tools/misc/stlink/default.nix @@ -30,6 +30,8 @@ stdenv.mkDerivation rec { sha256 = "sha256-hlFI2xpZ4ldMcxZbg/T5/4JuFFdO9THLcU0DQKSFqrw="; }; + patches = [ ./calloc-argument-order.patch ]; + buildInputs = [ libusb1'