All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/azure-iot-sdk-c: fix build with gcc 11
@ 2021-08-03 14:23 Fabrice Fontaine
  2021-08-04 20:39 ` Arnout Vandecappelle
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2021-08-03 14:23 UTC (permalink / raw)
  To: buildroot; +Cc: Sergio Prado, Fabrice Fontaine

Fix the following build failure with gcc 11:

/tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/src/hmac.c:211:43: error: argument 2 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Werror=array-parameter=]
  211 | int hmacResult(HMACContext *ctx, uint8_t *digest)
      |                                  ~~~~~~~~~^~~~~~
In file included from /tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/src/hmac.c:13:
/tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/inc/azure_c_shared_utility/sha.h:252:42: note: previously declared as an array 'uint8_t[64]' {aka 'unsigned char[64]'}
  252 | int hmacResult(HMACContext *ctx, uint8_t digest[USHAMaxHashSize]);
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/11a6eebd0deea679683a93a5c8355d00acdfe51e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...c-fix-mismatching-function-prototype.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch

diff --git a/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch b/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch
new file mode 100644
index 0000000000..0c262e6c46
--- /dev/null
+++ b/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch
@@ -0,0 +1,35 @@
+From 3a7997af72e7a4f70109d1639e6725b39046443e Mon Sep 17 00:00:00 2001
+From: Francesco Giancane <30423178+fgiancane8@users.noreply.github.com>
+Date: Fri, 2 Jul 2021 20:47:38 +0200
+Subject: [PATCH] hmac.c: fix mismatching function prototype (#537)
+
+The reported function raises a warning when compilers assert the flag
+`-Warray-parameter=`, signaling that an array-type argument was promoted
+to a pointer-type argument.
+
+While in practice in most C implementations this is correct, fixing the
+warning (and, in this case, indicating the maximum size for the array)
+would represent a best-practice for finding out-of-bound accesses or
+identifying wrongly-sized arrays passed in the function.
+
+Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
+[Retrieved from:
+https://github.com/Azure/azure-c-shared-utility/commit/3a7997af72e7a4f70109d1639e6725b39046443e]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/hmac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/hmac.c b/src/hmac.c
+index 53f2411f8..160af9d2f 100644
+--- a/c-utility/src/hmac.c
++++ b/c-utility/src/hmac.c
+@@ -208,7 +208,7 @@ int hmacFinalBits(HMACContext *ctx,
+ *   sha Error Code.
+ *
+ */
+-int hmacResult(HMACContext *ctx, uint8_t *digest)
++int hmacResult(HMACContext *ctx, uint8_t digest[USHAMaxHashSize])
+ {
+     if (!ctx) return shaNull;
+ 
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/azure-iot-sdk-c: fix build with gcc 11
  2021-08-03 14:23 [Buildroot] [PATCH 1/1] package/azure-iot-sdk-c: fix build with gcc 11 Fabrice Fontaine
@ 2021-08-04 20:39 ` Arnout Vandecappelle
  0 siblings, 0 replies; 2+ messages in thread
From: Arnout Vandecappelle @ 2021-08-04 20:39 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Sergio Prado



On 03/08/2021 16:23, Fabrice Fontaine wrote:
> Fix the following build failure with gcc 11:
> 
> /tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/src/hmac.c:211:43: error: argument 2 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Werror=array-parameter=]
>   211 | int hmacResult(HMACContext *ctx, uint8_t *digest)
>       |                                  ~~~~~~~~~^~~~~~
> In file included from /tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/src/hmac.c:13:
> /tmp/instance-7/output-1/build/azure-iot-sdk-c-LTS_01_2021_Ref01/c-utility/inc/azure_c_shared_utility/sha.h:252:42: note: previously declared as an array 'uint8_t[64]' {aka 'unsigned char[64]'}
>   252 | int hmacResult(HMACContext *ctx, uint8_t digest[USHAMaxHashSize]);
>       |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/11a6eebd0deea679683a93a5c8355d00acdfe51e
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

 Applied to master, thanks.

 Regards,
 Arnout

> ---
>  ...c-fix-mismatching-function-prototype.patch | 35 +++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100644 package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch
> 
> diff --git a/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch b/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch
> new file mode 100644
> index 0000000000..0c262e6c46
> --- /dev/null
> +++ b/package/azure-iot-sdk-c/0001-hmac-c-fix-mismatching-function-prototype.patch
> @@ -0,0 +1,35 @@
> +From 3a7997af72e7a4f70109d1639e6725b39046443e Mon Sep 17 00:00:00 2001
> +From: Francesco Giancane <30423178+fgiancane8@users.noreply.github.com>
> +Date: Fri, 2 Jul 2021 20:47:38 +0200
> +Subject: [PATCH] hmac.c: fix mismatching function prototype (#537)
> +
> +The reported function raises a warning when compilers assert the flag
> +`-Warray-parameter=`, signaling that an array-type argument was promoted
> +to a pointer-type argument.
> +
> +While in practice in most C implementations this is correct, fixing the
> +warning (and, in this case, indicating the maximum size for the array)
> +would represent a best-practice for finding out-of-bound accesses or
> +identifying wrongly-sized arrays passed in the function.
> +
> +Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
> +[Retrieved from:
> +https://github.com/Azure/azure-c-shared-utility/commit/3a7997af72e7a4f70109d1639e6725b39046443e]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + src/hmac.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/hmac.c b/src/hmac.c
> +index 53f2411f8..160af9d2f 100644
> +--- a/c-utility/src/hmac.c
> ++++ b/c-utility/src/hmac.c
> +@@ -208,7 +208,7 @@ int hmacFinalBits(HMACContext *ctx,
> + *   sha Error Code.
> + *
> + */
> +-int hmacResult(HMACContext *ctx, uint8_t *digest)
> ++int hmacResult(HMACContext *ctx, uint8_t digest[USHAMaxHashSize])
> + {
> +     if (!ctx) return shaNull;
> + 
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-04 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 14:23 [Buildroot] [PATCH 1/1] package/azure-iot-sdk-c: fix build with gcc 11 Fabrice Fontaine
2021-08-04 20:39 ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.