[PATCH] drm/xe/guc: Fix size_t print format

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Jan 28 22:47:04 UTC 2025


On Tue, Jan 28, 2025 at 07:42:42AM -0800, Lucas De Marchi wrote:
> Use %zx format to print size_t to remove the following warning when
> building for i386:
> 
>    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~
> >> drivers/gpu/drm/xe/xe_guc_ct.c:1727:43: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
>     1727 |                         drm_printf(p, "[CTB].length: 0x%lx\n", snapshot->ctb_size);
>          |                                                        ~~~     ^~~~~~~~~~~~~~~~~~
>          |                                                        %zx
> 
> Cc: José Roberto de Souza <jose.souza at intel.com>
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501281627.H6nj184e-lkp@intel.com/
> Fixes: cb1f868ca137 ("drm/xe: Make GUC binaries dump consistent with other binaries in devcoredump")
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_ct.c  | 2 +-
>  drivers/gpu/drm/xe/xe_guc_log.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 497036675a38c..72ad576fc18eb 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1724,7 +1724,7 @@ void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot,
>  			   snapshot->g2h_outstanding);
>  
>  		if (snapshot->ctb) {
> -			drm_printf(p, "[CTB].length: 0x%lx\n", snapshot->ctb_size);
> +			drm_printf(p, "[CTB].length: 0x%zx\n", snapshot->ctb_size);
>  			xe_print_blob_ascii85(p, "[CTB].data", '\n',
>  					      snapshot->ctb, 0, snapshot->ctb_size);
>  		}
> diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
> index ab97ac728d7a8..80514a446ba28 100644
> --- a/drivers/gpu/drm/xe/xe_guc_log.c
> +++ b/drivers/gpu/drm/xe/xe_guc_log.c
> @@ -204,7 +204,7 @@ void xe_guc_log_snapshot_print(struct xe_guc_log_snapshot *snapshot, struct drm_
>  	drm_printf(p, "GuC timestamp: 0x%08llX [%llu]\n", snapshot->stamp, snapshot->stamp);
>  	drm_printf(p, "Log level: %u\n", snapshot->level);
>  
> -	drm_printf(p, "[LOG].length: 0x%lx\n", snapshot->size);
> +	drm_printf(p, "[LOG].length: 0x%zx\n", snapshot->size);
>  	remain = snapshot->size;
>  	for (i = 0; i < snapshot->num_chunks; i++) {
>  		size_t size = min(GUC_LOG_CHUNK_SIZE, remain);
> -- 
> 2.48.0
> 


More information about the Intel-xe mailing list