Re: git: 8b43286fc3ba - main - vchiq: fix another logging format string for 32/64 bit

From: Mitchell Horne <mhorne_at_freebsd.org>
Date: Fri, 31 Oct 2025 15:24:13 UTC
--- vchiq_2835_arm.o ---
/usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c:549:71: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
  549 |                 "free_pagelist - %zx, %d (%u bytes @%p)", (size_t)pagelist, actual, pagelist->length, bi->buf);
      |                                           ~~                                        ^~~~~~~~~~~~~~~~
      |                                           %lu
/usr/src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h:73:39: note: expanded from macro 'vchiq_log_trace'
   73 |                 printf(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
      |                                         ~~~         ^~~~~~~~~~~
1 error generated.
*** [vchiq_2835_arm.o] Error code 1

This broke the build on armv7, I suggest a revert. Also one question below...

On 10/29/25 21:48, Adrian Chadd wrote:
> The branch main has been updated by adrian:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=8b43286fc3badc646ff5a828bae226c8fca90268
> 
> commit 8b43286fc3badc646ff5a828bae226c8fca90268
> Author:     Marco Devesas Campos <devesas.campos@gmail.com>
> AuthorDate: 2025-10-26 23:08:24 +0000
> Commit:     Adrian Chadd <adrian@FreeBSD.org>
> CommitDate: 2025-10-30 00:48:12 +0000
> 
>     vchiq: fix another logging format string for 32/64 bit
>     
>     This is from work from https://reviews.freebsd.org/D37878.
>     
>     Submitted by: Marco Devesas Campos <devesas.campos@gmail.com>
>     Differential Revision:  https://reviews.freebsd.org/D53372
> ---
>  sys/arm/broadcom/bcm2835/bcm2835_audio.c           |  5 ++--
>  .../vchiq/interface/vchiq_arm/vchiq_2835_arm.c     | 11 ++++-----
>  sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c  | 28 +++++++++++-----------
>  3 files changed, 21 insertions(+), 23 deletions(-)
> 
> diff --git a/sys/arm/broadcom/bcm2835/bcm2835_audio.c b/sys/arm/broadcom/bcm2835/bcm2835_audio.c
> index 74dede21c0df..2df6ac76124f 100644
> --- a/sys/arm/broadcom/bcm2835/bcm2835_audio.c
> +++ b/sys/arm/broadcom/bcm2835/bcm2835_audio.c
> @@ -260,8 +260,9 @@ bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *m
>  					device_printf(sc->dev, "available_space == %d, count = %d, perr=%d\n",
>  					    ch->available_space, count, perr);
>  					device_printf(sc->dev,
> -					    "retrieved_samples = %lld, submitted_samples = %lld\n",
> -					    ch->retrieved_samples, ch->submitted_samples);
> +					    "retrieved_samples = %ju, submitted_samples = %ju\n",
> +					    (uintmax_t)ch->retrieved_samples,
> +					    (uintmax_t)ch->submitted_samples);
>  				}
>  				ch->available_space += count;
>  				ch->retrieved_samples += count;
> diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
> index 0150ce72f0a4..f4aee12dec53 100644
> --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
> +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
> @@ -204,8 +204,8 @@ vchiq_platform_init(VCHIQ_STATE_T *state)
>  	bcm_mbox_write(BCM2835_MBOX_CHAN_VCHIQ, (unsigned int)g_slot_phys);
>  
>  	vchiq_log_info(vchiq_arm_log_level,
> -		"vchiq_init - done (slots %x, phys %x)",
> -		(unsigned int)vchiq_slot_zero, g_slot_phys);
> +		"vchiq_init - done (slots %zx, phys %zx)",
> +		(size_t)vchiq_slot_zero, g_slot_phys);
>  
>     vchiq_call_connected_callbacks();
>  
> @@ -451,10 +451,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
>  	}
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"create_pagelist - %x (%d bytes @%p)", (unsigned int)pagelist, count, buf);
> -
> -	if (!pagelist)
> -		return -ENOMEM;

Was this hunk unintended? I ask because it seems outside the reported scope of the change.

Thanks,
Mitchell

> +		"create_pagelist - %zx (%zu bytes @%p)", (size_t)pagelist, count, buf);
>  
>  	addrs = pagelist->addrs;
>  	pages = (vm_page_t*)(addrs + num_pages);
> @@ -549,7 +546,7 @@ free_pagelist(BULKINFO_T *bi, int actual)
>  	pagelist = bi->pagelist;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"free_pagelist - %x, %d (%lu bytes @%p)", (unsigned int)pagelist, actual, pagelist->length, bi->buf);
> +		"free_pagelist - %zx, %d (%u bytes @%p)", (size_t)pagelist, actual, pagelist->length, bi->buf);
>  
>  	num_pages =
>  		(pagelist->length + pagelist->offset + PAGE_SIZE - 1) /
> diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
> index 763cd9ce9417..e25c4d738922 100644
> --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
> +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
> @@ -442,8 +442,8 @@ vchiq_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag,
>  #define	_IOC_TYPE(x)	IOCGROUP(x)
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		 "vchiq_ioctl - instance %x, cmd %s, arg %p",
> -		(unsigned int)instance,
> +		 "vchiq_ioctl - instance %zx, cmd %s, arg %p",
> +		(size_t)instance,
>  		((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) &&
>  		(_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ?
>  		ioctl_names[_IOC_NR(cmd)] : "<invalid>", arg);
> @@ -745,8 +745,8 @@ vchiq_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag,
>  				break;
>  			}
>  			vchiq_log_info(vchiq_arm_log_level,
> -				"found bulk_waiter %x for pid %d",
> -				(unsigned int)waiter, current->p_pid);
> +				"found bulk_waiter %zx for pid %d",
> +				(size_t)waiter, current->p_pid);
>  			args.userdata = &waiter->bulk_waiter;
>  		}
>  		status = vchiq_bulk_transfer
> @@ -776,8 +776,8 @@ vchiq_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag,
>  			list_add(&waiter->list, &instance->bulk_waiter_list);
>  			lmutex_unlock(&instance->bulk_waiter_list_mutex);
>  			vchiq_log_info(vchiq_arm_log_level,
> -				"saved bulk_waiter %x for pid %d",
> -				(unsigned int)waiter, current->p_pid);
> +				"saved bulk_waiter %zx for pid %d",
> +				(size_t)waiter, current->p_pid);
>  
>  			memcpy((void *)
>  				&(((VCHIQ_QUEUE_BULK_TRANSFER_T *)
> @@ -860,9 +860,9 @@ vchiq_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag,
>  					if (args.msgbufsize < msglen) {
>  						vchiq_log_error(
>  							vchiq_arm_log_level,
> -							"header %x: msgbufsize"
> +							"header %zx: msgbufsize"
>  							" %x < msglen %x",
> -							(unsigned int)header,
> +							(size_t)header,
>  							args.msgbufsize,
>  							msglen);
>  						WARN(1, "invalid message "
> @@ -1031,8 +1031,8 @@ vchiq_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int fflag,
>  				ret = -EFAULT;
>  		} else {
>  			vchiq_log_error(vchiq_arm_log_level,
> -				"header %x: bufsize %x < size %x",
> -				(unsigned int)header, args.bufsize,
> +				"header %zx: bufsize %x < size %x",
> +				(size_t)header, args.bufsize,
>  				header->size);
>  			WARN(1, "invalid size\n");
>  			ret = -EMSGSIZE;
> @@ -1435,9 +1435,9 @@ vchiq_dump_platform_instances(void *dump_context)
>  			instance = service->instance;
>  			if (instance && !instance->mark) {
>  				len = snprintf(buf, sizeof(buf),
> -					"Instance %x: pid %d,%s completions "
> +					"Instance %zx: pid %d,%s completions "
>  						"%d/%d",
> -					(unsigned int)instance, instance->pid,
> +					(size_t)instance, instance->pid,
>  					instance->connected ? " connected, " :
>  						"",
>  					instance->completion_insert -
> @@ -1465,8 +1465,8 @@ vchiq_dump_platform_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
>  	char buf[80];
>  	int len;
>  
> -	len = snprintf(buf, sizeof(buf), "  instance %x",
> -		(unsigned int)service->instance);
> +	len = snprintf(buf, sizeof(buf), "  instance %zx",
> +		(size_t)service->instance);
>  
>  	if ((service->base.callback == service_callback) &&
>  		user_service->is_vchi) {