Skip to contentSkip to conversation

Expanding the basic vkms features

PATCH Superseded Rodrigo Siqueira 2 participants 6 messages Jun 17, 2018 Library code

lore
Share & tools
lore
#0 lore raw

v2 cover Expanding the basic vkms features

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

Changes in v2:
- Better fit the string size for the path requirements
- Improves commit messages

Rodrigo Siqueira (3):
Avoid truncate string in __igt_lsof_fds
Account for NULL character when using strncpy
Move declaration to the top of the code

 lib/igt_aux.c                    |  8 ++++++--
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH v2 1/3 Avoid truncate string in __igt_lsof_fds

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 commit fixes this problem by changing the string size passed by __igt_lsoft to __igt_lsof_fds; basically, the max size for the string is calculated in a directive and then used to declare the array.

---
 lib/igt_aux.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/igt_aux.c +5 -1
index acafb713..1ea52efe 100644
@@ -48,6 +48,8 @@
 #include <sys/utsname.h>
 #include <termios.h>
 #include <assert.h>
+#include <math.h>
+#include <limits.h>
 
 #include <proc/readproc.h>
 #include <libudev.h>
@@ -71,6 +73,8 @@
 #include <libgen.h>   /* for dirname() */
 #endif
 
+#define MAX_CWD_LEN (unsigned int)(sizeof("/proc//cwd") + ceil(log10(INT_MAX)))
+
 /**
  * SECTION:igt_aux
  * @short_description: Auxiliary libraries and support functions
@@ -1485,7 +1489,7 @@ __igt_lsof(const char *dir)
 	PROCTAB *proc;
 	proc_t *proc_info;
 
-	char path[PATH_MAX];
+	char path[MAX_CWD_LEN];
 	char *name_lnk;
 	struct stat st;
 	int state = 0;
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 2/3 Account for NULL character when using strncpy

In reply to Rodrigo Siqueira

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'.

---
 lib/igt_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_aux.c +1 -1
index 1ea52efe..a605becc 100644
@@ -1244,7 +1244,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);
 
 	fd = open(file_path, O_RDONLY);
 	igt_assert(fd >= 0);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v2 3/3 Move declaration to the top of the code

In reply to Rodrigo Siqueira

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] [..]

---
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)
lib/igt_color_encoding.c +6 -10
index b1648a74..1a89bb46 100644
@@ -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,
tests/kms_frontbuffer_tracking.c +1 -1
index 8754cc46..dbb8ba62 100644
@@ -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);
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Expanding the basic vkms features

In reply to Rodrigo Siqueira
== Series Details ==

== Series Details ==

Series: Expanding the basic vkms features
URL : https://patchwork.freedesktop.org/series/44889/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4329 -> IGTPW_1472 =

== Summary - SUCCESS ==

No regressions found.

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

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

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       NOTRUN -> DMESG-WARN (fdo#106000, fdo#106097) +1

    igt@kms_pipe_crc_basic@read-crc-pipe-c-frame-sequence:
      fi-glk-j4005:       NOTRUN -> DMESG-WARN (fdo#106000)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-glk-j4005:       NOTRUN -> DMESG-WARN (fdo#106097) +2

    
    ==== Possible fixes ====

    igt@gem_exec_gttfill@basic:
      fi-byt-n2820:       FAIL (fdo#106744) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-skl-6260u:       INCOMPLETE (fdo#104108) -> PASS

fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
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
fdo#106744 https://bugs.freedesktop.org/show_bug.cgi?id=106744

== Participating hosts (42 -> 35) ==

Additional (1): fi-glk-j4005
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510 fi-kbl-r

== Build changes ==

* IGT: IGT_4521 -> IGTPW_1472

CI_DRM_4329: 02d8db1a894b0e646b2debd64ce24b8e99fd2ffd @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1472: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1472/
IGT_4521: 4aa49a88acdaafed8235837d85a099ad941fc281 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

#5 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for Expanding the basic vkms features

In reply to Rodrigo Siqueira
== Series Details ==

== Series Details ==

Series: Expanding the basic vkms features
URL : https://patchwork.freedesktop.org/series/44889/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4521_full -> IGTPW_1472_full =

== Summary - WARNING ==

Minor unknown changes coming with IGTPW_1472_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_1472_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/44889/revisions/1/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

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

    igt@kms_cursor_legacy@cursora-vs-flipa-atomic-transitions-varying-size:
      shard-snb:          SKIP -> PASS

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS +1

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_eio@hibernate:
      shard-glk:          NOTRUN -> INCOMPLETE (k.org#198133, fdo#103359)

    igt@gem_eio@suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665) +1
      shard-apl:          PASS -> INCOMPLETE (fdo#103927) +1
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#103359) +1

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

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

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

    
    ==== Possible fixes ====

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

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

    igt@gem_eio@reset-stress:
      shard-glk:          FAIL -> PASS
      shard-hsw:          FAIL -> PASS
      shard-kbl:          FAIL -> PASS
      shard-snb:          FAIL -> PASS
      shard-apl:          FAIL -> PASS

    igt@kms_cursor_legacy@2x-nonblocking-modeset-vs-cursor-atomic:
      shard-glk:          FAIL (fdo#105454, fdo#106509) -> PASS

    igt@kms_flip@flip-vs-absolute-wf_vblank:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          FAIL (fdo#102887) -> PASS

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

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

    igt@perf@polling:
      shard-hsw:          FAIL (fdo#102252) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
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#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
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_4521 -> IGTPW_1472
* Linux: CI_DRM_4325 -> CI_DRM_4329

CI_DRM_4325: 4275ebe85ad179007c49b7bcf78d340b7681871e @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4329: 02d8db1a894b0e646b2debd64ce24b8e99fd2ffd @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1472: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1472/
IGT_4521: 4aa49a88acdaafed8235837d85a099ad941fc281 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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