diff mbox

[i-g-t,1/5] tools/intel_watermark: Silence gcc7 snprintf() warnings

Message ID 20171121184930.25826-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Nov. 21, 2017, 6:49 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Bump the snprintf() buffer size to 32 bytes to silence gcc.

intel_watermark.c:203:57: warning: ‘%c’ directive output may be truncated writing 1 byte into a region of size between 0 and 9 [-Wformat-truncation=]
      snprintf(reg_name, sizeof(reg_name), "PLANE_WM_%1d_%c_%1d",
                                                         ^~
intel_watermark.c:203:43: note: directive argument in the range [0, 8]
      snprintf(reg_name, sizeof(reg_name), "PLANE_WM_%1d_%c_%1d",
                                           ^~~~~~~~~~~~~~~~~~~~~
etc.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tools/intel_watermark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tvrtko Ursulin Nov. 21, 2017, 7:45 p.m. UTC | #1
On 21/11/2017 18:49, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Bump the snprintf() buffer size to 32 bytes to silence gcc.
> 
> intel_watermark.c:203:57: warning: ‘%c’ directive output may be truncated writing 1 byte into a region of size between 0 and 9 [-Wformat-truncation=]
>        snprintf(reg_name, sizeof(reg_name), "PLANE_WM_%1d_%c_%1d",
>                                                           ^~
> intel_watermark.c:203:43: note: directive argument in the range [0, 8]
>        snprintf(reg_name, sizeof(reg_name), "PLANE_WM_%1d_%c_%1d",
>                                             ^~~~~~~~~~~~~~~~~~~~~
> etc.
> 
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   tools/intel_watermark.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c
> index c09772eea334..1d087b49f8c2 100644
> --- a/tools/intel_watermark.c
> +++ b/tools/intel_watermark.c
> @@ -163,7 +163,7 @@ static void skl_wm_dump(void)
>   	uint32_t wm_trans[num_pipes][max_planes];
>   	uint32_t buf_cfg[num_pipes][max_planes];
>   	uint32_t wm_linetime[num_pipes];
> -	char reg_name[20];
> +	char reg_name[32];
>   
>   	intel_register_access_init(intel_get_pci_device(), 0, -1);
>   
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Tested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c
index c09772eea334..1d087b49f8c2 100644
--- a/tools/intel_watermark.c
+++ b/tools/intel_watermark.c
@@ -163,7 +163,7 @@  static void skl_wm_dump(void)
 	uint32_t wm_trans[num_pipes][max_planes];
 	uint32_t buf_cfg[num_pipes][max_planes];
 	uint32_t wm_linetime[num_pipes];
-	char reg_name[20];
+	char reg_name[32];
 
 	intel_register_access_init(intel_get_pci_device(), 0, -1);