All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/3] Fix some GCC warnings
@ 2018-05-30  0:46 ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

During the compilation, some GCC (8.1) warnings are shown. This patchset
address some of the warnings problems.

Rodrigo Siqueira (3):
  Avoid truncate string in __igt_lsof_fds
  Remove extra '\0' in strncpy in igt_save_module_param
  Move declaration to the top of the code

 lib/igt_aux.c                    |  4 ++--
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 3 files changed, 9 insertions(+), 13 deletions(-)

-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t 0/3] Fix some GCC warnings
@ 2018-05-30  0:46 ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

During the compilation, some GCC (8.1) warnings are shown. This patchset
address some of the warnings problems.

Rodrigo Siqueira (3):
  Avoid truncate string in __igt_lsof_fds
  Remove extra '\0' in strncpy in igt_save_module_param
  Move declaration to the top of the code

 lib/igt_aux.c                    |  4 ++--
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 3 files changed, 9 insertions(+), 13 deletions(-)

-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
@ 2018-05-30  0:46   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Note that 'proc_path' parameter in __igt_lsof_fds receives a string
which was initialized with the size of PATH_MAX and the local variable
'path' has the same size, but it also have to append: '/', '\0', and the
directory name. This situation caused the warning described below.

warning: ‘%s’ directive output may be truncated writing up to 255 bytes
into a region of size between 0 and 4095 [-Wformat-truncation=]
snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
size 4096 [..]

This patch fix the above problem.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index acafb713..5dd2761e 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
 {
 	struct dirent *d;
 	struct stat st;
-	char path[PATH_MAX];
+	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'
 	char *fd_lnk;
 
 	/* default fds or kernel threads */
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
@ 2018-05-30  0:46   ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

Note that 'proc_path' parameter in __igt_lsof_fds receives a string
which was initialized with the size of PATH_MAX and the local variable
'path' has the same size, but it also have to append: '/', '\0', and the
directory name. This situation caused the warning described below.

warning: ‘%s’ directive output may be truncated writing up to 255 bytes
into a region of size between 0 and 4095 [-Wformat-truncation=]
snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
size 4096 [..]

This patch fix the above problem.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index acafb713..5dd2761e 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
 {
 	struct dirent *d;
 	struct stat st;
-	char path[PATH_MAX];
+	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'
 	char *fd_lnk;
 
 	/* default fds or kernel threads */
-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [PATCH i-g-t 2/3] Remove extra '\0' in strncpy in igt_save_module_param
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
@ 2018-05-30  0:46   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following gcc warning:

warning: ‘strncpy’ specified bound 32 equals destination size
[-Wstringop-truncation]
  strncpy(data->name, name, PARAM_NAME_MAX_SZ);

This error happens due to the '\0' character appended by strncpy. Notice
that reduces by one in the total of bytes to be copied, in this case, is
harmless because the strings received in the parameter already have
'\0'.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 5dd2761e..06f586d6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1240,7 +1240,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
 	data = calloc(1, sizeof (*data));
 	igt_assert(data);
 
-	strncpy(data->name, name, PARAM_NAME_MAX_SZ);
+	strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1); // -1 because of '\0'
 
 	fd = open(file_path, O_RDONLY);
 	igt_assert(fd >= 0);
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t 2/3] Remove extra '\0' in strncpy in igt_save_module_param
@ 2018-05-30  0:46   ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:46 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patch fix the following gcc warning:

warning: ‘strncpy’ specified bound 32 equals destination size
[-Wstringop-truncation]
  strncpy(data->name, name, PARAM_NAME_MAX_SZ);

This error happens due to the '\0' character appended by strncpy. Notice
that reduces by one in the total of bytes to be copied, in this case, is
harmless because the strings received in the parameter already have
'\0'.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 5dd2761e..06f586d6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1240,7 +1240,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
 	data = calloc(1, sizeof (*data));
 	igt_assert(data);
 
-	strncpy(data->name, name, PARAM_NAME_MAX_SZ);
+	strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1); // -1 because of '\0'
 
 	fd = open(file_path, O_RDONLY);
 	igt_assert(fd >= 0);
-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [PATCH i-g-t 3/3] Move declaration to the top of the code
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
@ 2018-05-30  0:47   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:47 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following gcc warnings:

warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement] [..]
igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]
igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index b1648a74..1a89bb46 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -36,11 +36,9 @@ static const struct color_encoding color_encodings[IGT_NUM_COLOR_ENCODINGS] = {
 
 static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = kr,
@@ -63,11 +61,9 @@ static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 
 static struct igt_mat4 ycbcr_to_rgb_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = 1.0f,
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 8754cc46..dbb8ba62 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1770,8 +1770,8 @@ static void do_status_assertions(int flags)
 static void __do_assertions(const struct test_mode *t, int flags,
 			    int line)
 {
-	flags = adjust_assertion_flags(t, flags);
 	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+	flags = adjust_assertion_flags(t, flags);
 
 	igt_debug("checking asserts in line %i\n", line);
 
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t 3/3] Move declaration to the top of the code
@ 2018-05-30  0:47   ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-05-30  0:47 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patch fix the following gcc warnings:

warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement] [..]
igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]
igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index b1648a74..1a89bb46 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -36,11 +36,9 @@ static const struct color_encoding color_encodings[IGT_NUM_COLOR_ENCODINGS] = {
 
 static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = kr,
@@ -63,11 +61,9 @@ static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 
 static struct igt_mat4 ycbcr_to_rgb_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = 1.0f,
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 8754cc46..dbb8ba62 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1770,8 +1770,8 @@ static void do_status_assertions(int flags)
 static void __do_assertions(const struct test_mode *t, int flags,
 			    int line)
 {
-	flags = adjust_assertion_flags(t, flags);
 	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+	flags = adjust_assertion_flags(t, flags);
 
 	igt_debug("checking asserts in line %i\n", line);
 
-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for Fix some GCC warnings
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
                   ` (3 preceding siblings ...)
  (?)
@ 2018-05-30  2:25 ` Patchwork
  -1 siblings, 0 replies; 20+ messages in thread
From: Patchwork @ 2018-05-30  2:25 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Fix some GCC warnings
URL   : https://patchwork.freedesktop.org/series/43913/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4255 -> IGTPW_1407 =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1407 need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1407, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/43913/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1407:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_1407 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload-inject:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106097)

    igt@gem_ctx_create@basic-files:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#105719)

    igt@kms_flip@basic-plain-flip:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106000)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-glk-j4005:       DMESG-WARN (fdo#106097) -> PASS +1

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         FAIL (fdo#102575) -> PASS

    igt@gem_mmap_gtt@basic-wc:
      fi-glk-j4005:       DMESG-WARN (fdo#105719) -> PASS

    igt@kms_chamelium@dp-edid-read:
      fi-kbl-7500u:       FAIL (fdo#103841) -> PASS

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       DMESG-WARN (fdo#106000) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
      fi-glk-j4005:       FAIL (fdo#103481) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-cnl-psr:         DMESG-WARN (fdo#104951) -> PASS

    
  fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
  fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
  fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
  fdo#105719 https://bugs.freedesktop.org/show_bug.cgi?id=105719
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097


== Participating hosts (45 -> 39) ==

  Missing    (6): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-cfl-u2 fi-skl-6700hq 


== Build changes ==

    * IGT: IGT_4499 -> IGTPW_1407

  CI_DRM_4255: 5550ce1b359dcbd8d9387e0501bc372f0c158eaa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1407: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1407/
  IGT_4499: f560ae5a464331f03f0a669ed46b8c9e56526187 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1407/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.IGT: failure for Fix some GCC warnings
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
                   ` (4 preceding siblings ...)
  (?)
@ 2018-05-30  4:26 ` Patchwork
  -1 siblings, 0 replies; 20+ messages in thread
From: Patchwork @ 2018-05-30  4:26 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Fix some GCC warnings
URL   : https://patchwork.freedesktop.org/series/43913/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4499_full -> IGTPW_1407_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1407_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1407_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/43913/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1407_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
      shard-snb:          PASS -> DMESG-WARN

    
    ==== Warnings ====

    igt@gem_shrink@reclaim:
      shard-snb:          PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_1407_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_gtt:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          PASS -> INCOMPLETE (fdo#106023, fdo#103665)

    igt@gem_softpin@noreloc-s3:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-glk:          PASS -> FAIL (fdo#105703)

    igt@kms_flip@2x-wf_vblank-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +1

    igt@kms_flip_tiling@flip-to-y-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724, fdo#103822) +1

    
    ==== Possible fixes ====

    {igt@kms_available_modes_crc@available_mode_test_crc}:
      shard-snb:          FAIL (fdo#106641) -> PASS

    igt@kms_cursor_crc@cursor-256x256-suspend:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS +1

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          FAIL (fdo#104724, fdo#103822) -> PASS

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          FAIL (fdo#104724, fdo#103166) -> PASS

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          FAIL (fdo#104724, fdo#103925) -> PASS

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4499 -> IGTPW_1407
    * Linux: CI_DRM_4238 -> CI_DRM_4255

  CI_DRM_4238: 2771a5e6347eb63e43fdfc432a9f15ffb55ef209 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4255: 5550ce1b359dcbd8d9387e0501bc372f0c158eaa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1407: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1407/
  IGT_4499: f560ae5a464331f03f0a669ed46b8c9e56526187 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1407/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for Fix some GCC warnings
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
                   ` (5 preceding siblings ...)
  (?)
@ 2018-06-04  8:39 ` Patchwork
  -1 siblings, 0 replies; 20+ messages in thread
From: Patchwork @ 2018-06-04  8:39 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Fix some GCC warnings
URL   : https://patchwork.freedesktop.org/series/43913/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4269 -> IGTPW_1412 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/43913/revisions/1/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1412 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@debugfs_test@read_all_entries:
      fi-bdw-gvtdvm:      PASS -> DMESG-WARN (fdo#105600) +2

    igt@gem_exec_suspend@basic-s3:
      fi-bdw-gvtdvm:      PASS -> INCOMPLETE (fdo#105600)
      fi-skl-gvtdvm:      PASS -> INCOMPLETE (fdo#105600, fdo#104108)

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         PASS -> FAIL (fdo#102575)

    igt@kms_flip@basic-plain-flip:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106097)

    
    ==== Possible fixes ====

    igt@drv_module_reload@basic-reload-inject:
      fi-glk-j4005:       DMESG-WARN (fdo#106248, fdo#106725) -> PASS

    igt@gem_exec_suspend@basic-s3:
      fi-skl-6700k2:      INCOMPLETE (k.org#199541, fdo#104108, fdo#105524) -> PASS

    igt@kms_busy@basic-flip-c:
      fi-glk-j4005:       FAIL (fdo#103182) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-kbl-7567u:       FAIL (fdo#103191, fdo#104724) -> PASS

    
  fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
  fdo#103182 https://bugs.freedesktop.org/show_bug.cgi?id=103182
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105524 https://bugs.freedesktop.org/show_bug.cgi?id=105524
  fdo#105600 https://bugs.freedesktop.org/show_bug.cgi?id=105600
  fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097
  fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
  fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
  k.org#199541 https://bugzilla.kernel.org/show_bug.cgi?id=199541


== Participating hosts (43 -> 38) ==

  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-cnl-y3 fi-skl-6700hq fi-cfl-u 


== Build changes ==

    * IGT: IGT_4503 -> IGTPW_1412

  CI_DRM_4269: 25dda01a94cbf70d599be9b0f74c61f310858fa3 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1412: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1412/
  IGT_4503: ae0ea2a0cff1cf8516d18ada5b9db01c56b73ed9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1412/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for Fix some GCC warnings
  2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
                   ` (6 preceding siblings ...)
  (?)
@ 2018-06-04  9:54 ` Patchwork
  -1 siblings, 0 replies; 20+ messages in thread
From: Patchwork @ 2018-06-04  9:54 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Fix some GCC warnings
URL   : https://patchwork.freedesktop.org/series/43913/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4503_full -> IGTPW_1412_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1412_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1412_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/43913/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1412_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd1:
      shard-kbl:          SKIP -> PASS +2

    igt@gem_exec_schedule@deep-bsd2:
      shard-kbl:          PASS -> SKIP +2

    igt@perf_pmu@cpu-hotplug:
      shard-apl:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1412_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_await@wide-contexts:
      shard-glk:          PASS -> FAIL (fdo#105900)

    igt@gem_wait@wait-render:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
      shard-hsw:          PASS -> FAIL (fdo#100368)
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_flip_tiling@flip-to-y-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724, fdo#103822)

    igt@kms_plane_scaling@pipe-a-scaler-with-clipping-clamping:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_gtt:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS

    igt@gem_exec_store@cachelines-vebox:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip_tiling@flip-to-x-tiled:
      shard-glk:          FAIL (fdo#104724) -> PASS

    igt@testdisplay:
      shard-glk:          INCOMPLETE (k.org#198133, fdo#103359) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
  fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4503 -> IGTPW_1412
    * Linux: CI_DRM_4265 -> CI_DRM_4269

  CI_DRM_4265: 1bef5a8b1f02a5a612ac38bc6d7950becc2a9aa8 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4269: 25dda01a94cbf70d599be9b0f74c61f310858fa3 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1412: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1412/
  IGT_4503: ae0ea2a0cff1cf8516d18ada5b9db01c56b73ed9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1412/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
  2018-05-30  0:46   ` [igt-dev] " Rodrigo Siqueira
@ 2018-06-04 10:40     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 10:40 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, May 29, 2018 at 09:46:38PM -0300, Rodrigo Siqueira wrote:
> Note that 'proc_path' parameter in __igt_lsof_fds receives a string
> which was initialized with the size of PATH_MAX and the local variable
> 'path' has the same size, but it also have to append: '/', '\0', and the
> directory name. This situation caused the warning described below.
> 
> warning: ‘%s’ directive output may be truncated writing up to 255 bytes
> into a region of size between 0 and 4095 [-Wformat-truncation=]
> snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
> note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
> size 4096 [..]
> 
> This patch fix the above problem.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_aux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index acafb713..5dd2761e 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
>  {
>  	struct dirent *d;
>  	struct stat st;
> -	char path[PATH_MAX];
> +	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'

Hey,

First of, thanks for looking at the new warnings. We definitely have to
fix those :-)

A couple of lines down we have lstat(path, &st), which will return -1
with errno == ENAMETOOLONG if we go over PATH_MAX, so this does not feel
right, especially that we are not checking for that.

Digging deeper, __igt_lsof_fds() is used only inside __igt_lsof(), which
is the reason for such a high estimate.

It uses char path[PATH_MAX], which is the main contributing component,
but it contains at most strlen("/proc/%d/cwd")+1 where "%d" is
CEILING(LOG_10(INT_MAX)).

Limiting size of path there to sensible upper estimation should make us
fit in PATH_MAX in __igt_lsof_fds (or even less).

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
@ 2018-06-04 10:40     ` Arkadiusz Hiler
  0 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 10:40 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, May 29, 2018 at 09:46:38PM -0300, Rodrigo Siqueira wrote:
> Note that 'proc_path' parameter in __igt_lsof_fds receives a string
> which was initialized with the size of PATH_MAX and the local variable
> 'path' has the same size, but it also have to append: '/', '\0', and the
> directory name. This situation caused the warning described below.
> 
> warning: ‘%s’ directive output may be truncated writing up to 255 bytes
> into a region of size between 0 and 4095 [-Wformat-truncation=]
> snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
> note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
> size 4096 [..]
> 
> This patch fix the above problem.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_aux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index acafb713..5dd2761e 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
>  {
>  	struct dirent *d;
>  	struct stat st;
> -	char path[PATH_MAX];
> +	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'

Hey,

First of, thanks for looking at the new warnings. We definitely have to
fix those :-)

A couple of lines down we have lstat(path, &st), which will return -1
with errno == ENAMETOOLONG if we go over PATH_MAX, so this does not feel
right, especially that we are not checking for that.

Digging deeper, __igt_lsof_fds() is used only inside __igt_lsof(), which
is the reason for such a high estimate.

It uses char path[PATH_MAX], which is the main contributing component,
but it contains at most strlen("/proc/%d/cwd")+1 where "%d" is
CEILING(LOG_10(INT_MAX)).

Limiting size of path there to sensible upper estimation should make us
fit in PATH_MAX in __igt_lsof_fds (or even less).

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 3/3] Move declaration to the top of the code
  2018-05-30  0:47   ` [igt-dev] " Rodrigo Siqueira
@ 2018-06-04 10:54     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 10:54 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, May 29, 2018 at 09:47:13PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following gcc warnings:
> 
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
> igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 3/3] Move declaration to the top of the code
@ 2018-06-04 10:54     ` Arkadiusz Hiler
  0 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 10:54 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, gustavo, intel-gfx

On Tue, May 29, 2018 at 09:47:13PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following gcc warnings:
> 
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
> igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 2/3] Remove extra '\0' in strncpy in igt_save_module_param
  2018-05-30  0:46   ` [igt-dev] " Rodrigo Siqueira
@ 2018-06-04 11:04     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 11:04 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

Title is slightly missleading. We don't remove extra NULL characer from
anywhere. We just account for it by subtracting 1 from the destination
buffer size.

So maybe "Account for NULL character when using strncpy"?

On Tue, May 29, 2018 at 09:46:55PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following gcc warning:
> 
> warning: ‘strncpy’ specified bound 32 equals destination size
> [-Wstringop-truncation]
>   strncpy(data->name, name, PARAM_NAME_MAX_SZ);
> 
> This error happens due to the '\0' character appended by strncpy. Notice
> that reduces by one in the total of bytes to be copied, in this case, is
> harmless because the strings received in the parameter already have
> '\0'.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_aux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 5dd2761e..06f586d6 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -1240,7 +1240,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
>  	data = calloc(1, sizeof (*data));
>  	igt_assert(data);
>  
> -	strncpy(data->name, name, PARAM_NAME_MAX_SZ);
> +	strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1); // -1 because of '\0'

I am not necessary sure that the comment is needed, as "buflen - 1" is
quite typical.

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH i-g-t 2/3] Remove extra '\0' in strncpy in igt_save_module_param
@ 2018-06-04 11:04     ` Arkadiusz Hiler
  0 siblings, 0 replies; 20+ messages in thread
From: Arkadiusz Hiler @ 2018-06-04 11:04 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

Title is slightly missleading. We don't remove extra NULL characer from
anywhere. We just account for it by subtracting 1 from the destination
buffer size.

So maybe "Account for NULL character when using strncpy"?

On Tue, May 29, 2018 at 09:46:55PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following gcc warning:
> 
> warning: ‘strncpy’ specified bound 32 equals destination size
> [-Wstringop-truncation]
>   strncpy(data->name, name, PARAM_NAME_MAX_SZ);
> 
> This error happens due to the '\0' character appended by strncpy. Notice
> that reduces by one in the total of bytes to be copied, in this case, is
> harmless because the strings received in the parameter already have
> '\0'.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_aux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 5dd2761e..06f586d6 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -1240,7 +1240,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
>  	data = calloc(1, sizeof (*data));
>  	igt_assert(data);
>  
> -	strncpy(data->name, name, PARAM_NAME_MAX_SZ);
> +	strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1); // -1 because of '\0'

I am not necessary sure that the comment is needed, as "buflen - 1" is
quite typical.

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
  2018-06-04 10:40     ` [Intel-gfx] " Arkadiusz Hiler
@ 2018-06-05  1:45       ` Rodrigo Siqueira
  -1 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-06-05  1:45 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Hi Arkadiusz,

First of all, thanks for the review.

I believe that I understood all the comments you made in all of the
patches. I will send the V2 soon.

Thanks!

Best Regards
Rodrigo Siqueira

On 06/04, Arkadiusz Hiler wrote:
> On Tue, May 29, 2018 at 09:46:38PM -0300, Rodrigo Siqueira wrote:
> > Note that 'proc_path' parameter in __igt_lsof_fds receives a string
> > which was initialized with the size of PATH_MAX and the local variable
> > 'path' has the same size, but it also have to append: '/', '\0', and the
> > directory name. This situation caused the warning described below.
> > 
> > warning: ‘%s’ directive output may be truncated writing up to 255 bytes
> > into a region of size between 0 and 4095 [-Wformat-truncation=]
> > snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
> > note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
> > size 4096 [..]
> > 
> > This patch fix the above problem.
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/igt_aux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> > index acafb713..5dd2761e 100644
> > --- a/lib/igt_aux.c
> > +++ b/lib/igt_aux.c
> > @@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
> >  {
> >  	struct dirent *d;
> >  	struct stat st;
> > -	char path[PATH_MAX];
> > +	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'
> 
> Hey,
> 
> First of, thanks for looking at the new warnings. We definitely have to
> fix those :-)
> 
> A couple of lines down we have lstat(path, &st), which will return -1
> with errno == ENAMETOOLONG if we go over PATH_MAX, so this does not feel
> right, especially that we are not checking for that.
> 
> Digging deeper, __igt_lsof_fds() is used only inside __igt_lsof(), which
> is the reason for such a high estimate.
> 
> It uses char path[PATH_MAX], which is the main contributing component,
> but it contains at most strlen("/proc/%d/cwd")+1 where "%d" is
> CEILING(LOG_10(INT_MAX)).
> 
> Limiting size of path there to sensible upper estimation should make us
> fit in PATH_MAX in __igt_lsof_fds (or even less).
> 
> -- 
> Cheers,
> Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds
@ 2018-06-05  1:45       ` Rodrigo Siqueira
  0 siblings, 0 replies; 20+ messages in thread
From: Rodrigo Siqueira @ 2018-06-05  1:45 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

Hi Arkadiusz,

First of all, thanks for the review.

I believe that I understood all the comments you made in all of the
patches. I will send the V2 soon.

Thanks!

Best Regards
Rodrigo Siqueira

On 06/04, Arkadiusz Hiler wrote:
> On Tue, May 29, 2018 at 09:46:38PM -0300, Rodrigo Siqueira wrote:
> > Note that 'proc_path' parameter in __igt_lsof_fds receives a string
> > which was initialized with the size of PATH_MAX and the local variable
> > 'path' has the same size, but it also have to append: '/', '\0', and the
> > directory name. This situation caused the warning described below.
> > 
> > warning: ‘%s’ directive output may be truncated writing up to 255 bytes
> > into a region of size between 0 and 4095 [-Wformat-truncation=]
> > snprintf(path, sizeof(path), "%s/%s", proc_path, d->d_name);
> > note: ‘snprintf’ output between 2 and 4352 bytes into a destination of
> > size 4096 [..]
> > 
> > This patch fix the above problem.
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/igt_aux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> > index acafb713..5dd2761e 100644
> > --- a/lib/igt_aux.c
> > +++ b/lib/igt_aux.c
> > @@ -1425,7 +1425,7 @@ __igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
> >  {
> >  	struct dirent *d;
> >  	struct stat st;
> > -	char path[PATH_MAX];
> > +	char path[PATH_MAX + NAME_MAX + 2]; // 1 byte for '/' and another for '\0'
> 
> Hey,
> 
> First of, thanks for looking at the new warnings. We definitely have to
> fix those :-)
> 
> A couple of lines down we have lstat(path, &st), which will return -1
> with errno == ENAMETOOLONG if we go over PATH_MAX, so this does not feel
> right, especially that we are not checking for that.
> 
> Digging deeper, __igt_lsof_fds() is used only inside __igt_lsof(), which
> is the reason for such a high estimate.
> 
> It uses char path[PATH_MAX], which is the main contributing component,
> but it contains at most strlen("/proc/%d/cwd")+1 where "%d" is
> CEILING(LOG_10(INT_MAX)).
> 
> Limiting size of path there to sensible upper estimation should make us
> fit in PATH_MAX in __igt_lsof_fds (or even less).
> 
> -- 
> Cheers,
> Arek
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-06-05  1:45 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30  0:46 [PATCH i-g-t 0/3] Fix some GCC warnings Rodrigo Siqueira
2018-05-30  0:46 ` [igt-dev] " Rodrigo Siqueira
2018-05-30  0:46 ` [PATCH i-g-t 1/3] Avoid truncate string in __igt_lsof_fds Rodrigo Siqueira
2018-05-30  0:46   ` [igt-dev] " Rodrigo Siqueira
2018-06-04 10:40   ` Arkadiusz Hiler
2018-06-04 10:40     ` [Intel-gfx] " Arkadiusz Hiler
2018-06-05  1:45     ` Rodrigo Siqueira
2018-06-05  1:45       ` [igt-dev] " Rodrigo Siqueira
2018-05-30  0:46 ` [PATCH i-g-t 2/3] Remove extra '\0' in strncpy in igt_save_module_param Rodrigo Siqueira
2018-05-30  0:46   ` [igt-dev] " Rodrigo Siqueira
2018-06-04 11:04   ` Arkadiusz Hiler
2018-06-04 11:04     ` [Intel-gfx] " Arkadiusz Hiler
2018-05-30  0:47 ` [PATCH i-g-t 3/3] Move declaration to the top of the code Rodrigo Siqueira
2018-05-30  0:47   ` [igt-dev] " Rodrigo Siqueira
2018-06-04 10:54   ` Arkadiusz Hiler
2018-06-04 10:54     ` [igt-dev] " Arkadiusz Hiler
2018-05-30  2:25 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix some GCC warnings Patchwork
2018-05-30  4:26 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-06-04  8:39 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-06-04  9:54 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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.