[PATCH rtems6 - v1 15/16] FIX: printf size warning on 64bit systems

Kinsey Moore kinsey.moore at oarcorp.com
Thu Jan 4 19:34:59 UTC 2024


This should be merged with a previous patch.

Kinsey

On Thu, Jan 4, 2024 at 12:35 PM <berndmoessner80 at gmail.com> wrote:

> From: Bernd Moessner <berndmoessner80 at gmail.com>
>
> ---
>  cpukit/dev/flash/flashdev.c         | 6 +++---
>  cpukit/include/dev/flash/flashdev.h | 6 ++++++
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/cpukit/dev/flash/flashdev.c b/cpukit/dev/flash/flashdev.c
> index ee06007a53..b3cec5af35 100644
> --- a/cpukit/dev/flash/flashdev.c
> +++ b/cpukit/dev/flash/flashdev.c
> @@ -40,6 +40,7 @@
>  #include <string.h>
>  #include <unistd.h>
>  #include <assert.h>
> +#include <inttypes.h>
>
>  #define RTEMS_FLASHDEV_MAX_PARTITIONS 16
>  #define RTEMS_FLASHDEV_PARTITION_ALLOC_FULL 0xFFFFFFFFUL
> @@ -316,9 +317,8 @@ static int rtems_flashdev_do_init(
>    void ( *destroy )( rtems_flashdev *flash )
>  )
>  {
> -  char mtx_name[19];
> -  sprintf(mtx_name, "FDEV_MTX_%08x", (unsigned int) flash);
> -  rtems_recursive_mutex_init( &flash->mutex, (const char*) &mtx_name);
> +  sprintf(flash->mtx_name, "FDEV_MTX_%" PRIXPTR, (uintptr_t) flash);
> +  rtems_recursive_mutex_init( &flash->mutex, (const char*)
> flash->mtx_name);
>    flash->destroy = destroy;
>    flash->read = NULL;
>    flash->write = NULL;
> diff --git a/cpukit/include/dev/flash/flashdev.h
> b/cpukit/include/dev/flash/flashdev.h
> index 7d7a70f5bc..47b488abe3 100644
> --- a/cpukit/include/dev/flash/flashdev.h
> +++ b/cpukit/include/dev/flash/flashdev.h
> @@ -427,6 +427,12 @@ struct rtems_flashdev {
>     * @brief Partition table
>     */
>    rtems_flashdev_partition *partition_table;
> +
> +  /**
> +   * @brief Storage for mutex name
> +   */
> +  char mtx_name[10 + sizeof(uintptr_t)];
> +
>  };
>
>  /**
> --
> 2.34.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240104/653c524d/attachment.htm>


More information about the devel mailing list