All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/komeda: fix size_t format string
@ 2019-06-17 12:49 Arnd Bergmann
  2019-06-17 13:32 ` Liviu Dudau
  2019-06-18  2:04   ` james qian wang (Arm Technology China)
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2019-06-17 12:49 UTC (permalink / raw)
  To: James (Qian) Wang, Liviu Dudau, Brian Starkey, David Airlie,
	Daniel Vetter
  Cc: Arnd Bergmann, Lowry Li (Arm Technology China), dri-devel, linux-kernel

The debug output uses the wrong format string for printing a size_t:

In file included from include/drm/drm_mm.h:49,
                 from include/drm/drm_vma_manager.h:26,
                 from include/drm/drm_gem.h:40,
                 from drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:9:
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c: In function 'komeda_fb_afbc_size_check':
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:96:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
   DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",

This is harmless in the kernel as size_t and long are always the same
width, but it's always better to use the correct format string
to shut up the warning.

Fixes: 9ccf536e53cb ("drm/komeda: Added AFBC support for komeda driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index abc8c0ccc053..58ff34e718d0 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -93,7 +93,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
 			       AFBC_SUPERBLK_ALIGNMENT);
 	min_size = kfb->afbc_size + fb->offsets[0];
 	if (min_size > obj->size) {
-		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
+		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%zx. min_size 0x%x.\n",
 			      obj->size, min_size);
 		goto check_failed;
 	}
@@ -137,7 +137,7 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev, struct komeda_fb *kfb,
 		min_size = komeda_fb_get_pixel_addr(kfb, 0, fb->height, i)
 			 - to_drm_gem_cma_obj(obj)->paddr;
 		if (obj->size < min_size) {
-			DRM_DEBUG_KMS("The fb->obj[%d] size: %ld lower than the minimum requirement: %d.\n",
+			DRM_DEBUG_KMS("The fb->obj[%d] size: %zd lower than the minimum requirement: %d.\n",
 				      i, obj->size, min_size);
 			return -EINVAL;
 		}
-- 
2.20.0


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

* Re: [PATCH] drm/komeda: fix size_t format string
  2019-06-17 12:49 [PATCH] drm/komeda: fix size_t format string Arnd Bergmann
@ 2019-06-17 13:32 ` Liviu Dudau
  2019-06-18  2:04   ` james qian wang (Arm Technology China)
  1 sibling, 0 replies; 4+ messages in thread
From: Liviu Dudau @ 2019-06-17 13:32 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James (Qian) Wang, Brian Starkey, David Airlie, Daniel Vetter,
	Lowry Li (Arm Technology China),
	dri-devel, linux-kernel

Hi Arnd,

On Mon, Jun 17, 2019 at 02:49:18PM +0200, Arnd Bergmann wrote:
> The debug output uses the wrong format string for printing a size_t:
> 
> In file included from include/drm/drm_mm.h:49,
>                  from include/drm/drm_vma_manager.h:26,
>                  from include/drm/drm_gem.h:40,
>                  from drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:9:
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c: In function 'komeda_fb_afbc_size_check':
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:96:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>    DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> 
> This is harmless in the kernel as size_t and long are always the same
> width, but it's always better to use the correct format string
> to shut up the warning.
> 
> Fixes: 9ccf536e53cb ("drm/komeda: Added AFBC support for komeda driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thank you for the patch! I did see the warning email sent by the build bots and
I've had the same fix in my stash, but then I've looked at the code using
min_size and I'm not happy with it, so I've asked James to come up with a patch
to fix things in a better way.

So, if you don't mind, I will delay this patch until James comes up with a fix
in the next couple of days. If he is not, then I'll pull the patch into mali-dp
tree (shared with komeda).

Best regards,
Liviu


> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> index abc8c0ccc053..58ff34e718d0 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> @@ -93,7 +93,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
>  			       AFBC_SUPERBLK_ALIGNMENT);
>  	min_size = kfb->afbc_size + fb->offsets[0];
>  	if (min_size > obj->size) {
> -		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> +		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%zx. min_size 0x%x.\n",
>  			      obj->size, min_size);
>  		goto check_failed;
>  	}
> @@ -137,7 +137,7 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev, struct komeda_fb *kfb,
>  		min_size = komeda_fb_get_pixel_addr(kfb, 0, fb->height, i)
>  			 - to_drm_gem_cma_obj(obj)->paddr;
>  		if (obj->size < min_size) {
> -			DRM_DEBUG_KMS("The fb->obj[%d] size: %ld lower than the minimum requirement: %d.\n",
> +			DRM_DEBUG_KMS("The fb->obj[%d] size: %zd lower than the minimum requirement: %d.\n",
>  				      i, obj->size, min_size);
>  			return -EINVAL;
>  		}
> -- 
> 2.20.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH] drm/komeda: fix size_t format string
  2019-06-17 12:49 [PATCH] drm/komeda: fix size_t format string Arnd Bergmann
@ 2019-06-18  2:04   ` james qian wang (Arm Technology China)
  2019-06-18  2:04   ` james qian wang (Arm Technology China)
  1 sibling, 0 replies; 4+ messages in thread
From: james qian wang (Arm Technology China) @ 2019-06-18  2:04 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Liviu Dudau, Brian Starkey, David Airlie, Daniel Vetter,
	Lowry Li (Arm Technology China),
	dri-devel, linux-kernel, nd

On Mon, Jun 17, 2019 at 02:49:18PM +0200, Arnd Bergmann wrote:
> The debug output uses the wrong format string for printing a size_t:
> 
> In file included from include/drm/drm_mm.h:49,
>                  from include/drm/drm_vma_manager.h:26,
>                  from include/drm/drm_gem.h:40,
>                  from drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:9:
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c: In function 'komeda_fb_afbc_size_check':
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:96:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>    DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> 
> This is harmless in the kernel as size_t and long are always the same
> width, but it's always better to use the correct format string
> to shut up the warning.
> 
> Fixes: 9ccf536e53cb ("drm/komeda: Added AFBC support for komeda driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> index abc8c0ccc053..58ff34e718d0 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> @@ -93,7 +93,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
>  			       AFBC_SUPERBLK_ALIGNMENT);
>  	min_size = kfb->afbc_size + fb->offsets[0];
>  	if (min_size > obj->size) {
> -		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> +		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%zx. min_size 0x%x.\n",
>  			      obj->size, min_size);
>  		goto check_failed;
>  	}
> @@ -137,7 +137,7 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev, struct komeda_fb *kfb,
>  		min_size = komeda_fb_get_pixel_addr(kfb, 0, fb->height, i)
>  			 - to_drm_gem_cma_obj(obj)->paddr;
>  		if (obj->size < min_size) {
> -			DRM_DEBUG_KMS("The fb->obj[%d] size: %ld lower than the minimum requirement: %d.\n",
> +			DRM_DEBUG_KMS("The fb->obj[%d] size: %zd lower than the minimum requirement: %d.\n",
>  				      i, obj->size, min_size);
>  			return -EINVAL;
>  		}
> -- 
> 2.20.0


Hi Arnd:

Thank you for the patch.

Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>

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

* Re: [PATCH] drm/komeda: fix size_t format string
@ 2019-06-18  2:04   ` james qian wang (Arm Technology China)
  0 siblings, 0 replies; 4+ messages in thread
From: james qian wang (Arm Technology China) @ 2019-06-18  2:04 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: nd, David Airlie, Liviu Dudau, linux-kernel, dri-devel,
	Lowry Li (Arm Technology China)

On Mon, Jun 17, 2019 at 02:49:18PM +0200, Arnd Bergmann wrote:
> The debug output uses the wrong format string for printing a size_t:
> 
> In file included from include/drm/drm_mm.h:49,
>                  from include/drm/drm_vma_manager.h:26,
>                  from include/drm/drm_gem.h:40,
>                  from drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:9:
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c: In function 'komeda_fb_afbc_size_check':
> drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c:96:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>    DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> 
> This is harmless in the kernel as size_t and long are always the same
> width, but it's always better to use the correct format string
> to shut up the warning.
> 
> Fixes: 9ccf536e53cb ("drm/komeda: Added AFBC support for komeda driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> index abc8c0ccc053..58ff34e718d0 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> @@ -93,7 +93,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
>  			       AFBC_SUPERBLK_ALIGNMENT);
>  	min_size = kfb->afbc_size + fb->offsets[0];
>  	if (min_size > obj->size) {
> -		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
> +		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%zx. min_size 0x%x.\n",
>  			      obj->size, min_size);
>  		goto check_failed;
>  	}
> @@ -137,7 +137,7 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev, struct komeda_fb *kfb,
>  		min_size = komeda_fb_get_pixel_addr(kfb, 0, fb->height, i)
>  			 - to_drm_gem_cma_obj(obj)->paddr;
>  		if (obj->size < min_size) {
> -			DRM_DEBUG_KMS("The fb->obj[%d] size: %ld lower than the minimum requirement: %d.\n",
> +			DRM_DEBUG_KMS("The fb->obj[%d] size: %zd lower than the minimum requirement: %d.\n",
>  				      i, obj->size, min_size);
>  			return -EINVAL;
>  		}
> -- 
> 2.20.0


Hi Arnd:

Thank you for the patch.

Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-18  2:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 12:49 [PATCH] drm/komeda: fix size_t format string Arnd Bergmann
2019-06-17 13:32 ` Liviu Dudau
2019-06-18  2:04 ` james qian wang (Arm Technology China)
2019-06-18  2:04   ` james qian wang (Arm Technology China)

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.