android: Fix compiler warning from GCC
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 27 Jun 2023 16:08:19 +0000 (18:08 +0200)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 13:34:03 +0000 (19:04 +0530)
commit4f70f527c27a774144996e576c1e547c64ffd02c
tree804dc11f211bd40d7455ae7e94aacd0594abc74a
parent1d6a4c9300cbde432cb072b7b6b2405f14b3d712
android: Fix compiler warning from GCC

This ignores the following two warnings from the compiler.

  CC       android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3733:9: error: ‘memcpy’ offset [0, 16] is out of the bounds [0, 0] [-Werror=array-bounds=]
 3733 |         memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  CC       android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3735:9: error: ‘memcpy’ writing 17 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 3735 |         memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It could be possible that these warnings are valid or they might be a
false positive. However since this is Android based code based on
Android HAL headers, just set pragma to ignore them.
android/gatt.c