All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/7] GCC warning cleanup
@ 2018-07-07 23:22 ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patchset fixes all the current GCC 8.1.1 warnings found in the IGT.

Rodrigo Siqueira (7):
  Remove parameter aliases with another argument
  Cast void * pointer used in arithmetic to uint32_t*
  Fix comparison that always evaluates to false
  Fix truncate string in the snprintf
  Make string commands dynamic allocate
  Fix truncate string in the strncpy
  Avoid truncate string in __igt_lsof_fds

 lib/igt_aux.c            |  2 +-
 lib/igt_core.c           |  6 +++---
 lib/igt_fb.c             |  6 ++++--
 tests/perf.c             | 10 +++++-----
 tools/intel_gvtg_test.c  | 27 ++++++++++++++++++---------
 tools/intel_reg.c        |  2 +-
 tools/intel_reg_decode.c |  2 +-
 7 files changed, 33 insertions(+), 22 deletions(-)

-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 0/7] GCC warning cleanup
@ 2018-07-07 23:22 ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patchset fixes all the current GCC 8.1.1 warnings found in the IGT.

Rodrigo Siqueira (7):
  Remove parameter aliases with another argument
  Cast void * pointer used in arithmetic to uint32_t*
  Fix comparison that always evaluates to false
  Fix truncate string in the snprintf
  Make string commands dynamic allocate
  Fix truncate string in the strncpy
  Avoid truncate string in __igt_lsof_fds

 lib/igt_aux.c            |  2 +-
 lib/igt_core.c           |  6 +++---
 lib/igt_fb.c             |  6 ++++--
 tests/perf.c             | 10 +++++-----
 tools/intel_gvtg_test.c  | 27 ++++++++++++++++++---------
 tools/intel_reg.c        |  2 +-
 tools/intel_reg_decode.c |  2 +-
 7 files changed, 33 insertions(+), 22 deletions(-)

-- 
2.18.0

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

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

* [PATCH i-g-t 1/7] Remove parameter aliases with another argument
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This commit fixes the following GCC warning:

warning: passing argument 2 to restrict-qualified parameter aliases with
argument 1 [-Wrestrict]
  return (readlink (buf, buf, sizeof (buf)) != -1 &&

This commit fixes the GCC warning by creating a second buffer only to
keep the path.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 3313050c..fa22f12d 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1169,10 +1169,10 @@ bool igt_can_fail(void)
 
 static bool run_under_gdb(void)
 {
-	char buf[1024];
+	char pathname[1024], buf[1024];
 
-	sprintf(buf, "/proc/%d/exe", getppid());
-	return (readlink (buf, buf, sizeof (buf)) != -1 &&
+	sprintf(pathname, "/proc/%d/exe", getppid());
+	return (readlink (pathname, buf, sizeof (buf)) != -1 &&
 		strncmp(basename(buf), "gdb", 3) == 0);
 }
 
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 1/7] Remove parameter aliases with another argument
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This commit fixes the following GCC warning:

warning: passing argument 2 to restrict-qualified parameter aliases with
argument 1 [-Wrestrict]
  return (readlink (buf, buf, sizeof (buf)) != -1 &&

This commit fixes the GCC warning by creating a second buffer only to
keep the path.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 3313050c..fa22f12d 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1169,10 +1169,10 @@ bool igt_can_fail(void)
 
 static bool run_under_gdb(void)
 {
-	char buf[1024];
+	char pathname[1024], buf[1024];
 
-	sprintf(buf, "/proc/%d/exe", getppid());
-	return (readlink (buf, buf, sizeof (buf)) != -1 &&
+	sprintf(pathname, "/proc/%d/exe", getppid());
+	return (readlink (pathname, buf, sizeof (buf)) != -1 &&
 		strncmp(basename(buf), "gdb", 3) == 0);
 }
 
-- 
2.18.0

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

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

* [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This commit fixes the GCC warning:

warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
                ^
warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[1], 0x80,

This commit cast the ptr pointer, which is a void *, to uint32_t * in
the pointer arithmetic operation.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_fb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..ca905038 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -410,9 +410,11 @@ static int create_bo_for_fb(int fd, int width, int height,
 
 			switch (format->drm_id) {
 			case DRM_FORMAT_NV12:
-				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
+				memset(((uint32_t *)ptr) + offsets[0],
+				       full_range ? 0x00 : 0x10,
 				       calculated_stride * height);
-				memset(ptr + offsets[1], 0x80,
+				memset(((uint32_t *)ptr) + offsets[1],
+				       0x80,
 				       calculated_stride * height/2);
 				break;
 			case DRM_FORMAT_YUYV:
-- 
2.18.0

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

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

* [Intel-gfx] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This commit fixes the GCC warning:

warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
                ^
warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
     memset(ptr + offsets[1], 0x80,

This commit cast the ptr pointer, which is a void *, to uint32_t * in
the pointer arithmetic operation.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_fb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..ca905038 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -410,9 +410,11 @@ static int create_bo_for_fb(int fd, int width, int height,
 
 			switch (format->drm_id) {
 			case DRM_FORMAT_NV12:
-				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
+				memset(((uint32_t *)ptr) + offsets[0],
+				       full_range ? 0x00 : 0x10,
 				       calculated_stride * height);
-				memset(ptr + offsets[1], 0x80,
+				memset(((uint32_t *)ptr) + offsets[1],
+				       0x80,
 				       calculated_stride * height/2);
 				break;
 			case DRM_FORMAT_YUYV:
-- 
2.18.0

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

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

* [PATCH i-g-t 3/7] Fix comparison that always evaluates to false
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This commit fix the GCC warning:

warning: bitwise comparison always evaluates to false
[-Wtautological-compare]
  } else if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL) {

The first comparison already checks DPLLB_MODE_LVDS, in this sense, the
second 'if' condition always will be false. This commit changes the
comparison to DPLLB_MODE_DAC_SERIAL.

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

diff --git a/tools/intel_reg_decode.c b/tools/intel_reg_decode.c
index f3c7d74a..5a632e09 100644
--- a/tools/intel_reg_decode.c
+++ b/tools/intel_reg_decode.c
@@ -1277,7 +1277,7 @@ DEBUGSTRING(ironlake_debug_pch_dpll)
 			p2 = "Div 7";
 		else
 			p2 = "Div 14";
-	} else if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL) {
+	} else if ((val & DPLLB_MODE_DAC_SERIAL) == DPLLB_MODE_DAC_SERIAL) {
 		mode = "Non-LVDS";
 		if (val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5)
 			p2 = "Div 5";
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 3/7] Fix comparison that always evaluates to false
@ 2018-07-07 23:22   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:22 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This commit fix the GCC warning:

warning: bitwise comparison always evaluates to false
[-Wtautological-compare]
  } else if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL) {

The first comparison already checks DPLLB_MODE_LVDS, in this sense, the
second 'if' condition always will be false. This commit changes the
comparison to DPLLB_MODE_DAC_SERIAL.

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

diff --git a/tools/intel_reg_decode.c b/tools/intel_reg_decode.c
index f3c7d74a..5a632e09 100644
--- a/tools/intel_reg_decode.c
+++ b/tools/intel_reg_decode.c
@@ -1277,7 +1277,7 @@ DEBUGSTRING(ironlake_debug_pch_dpll)
 			p2 = "Div 7";
 		else
 			p2 = "Div 14";
-	} else if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL) {
+	} else if ((val & DPLLB_MODE_DAC_SERIAL) == DPLLB_MODE_DAC_SERIAL) {
 		mode = "Non-LVDS";
 		if (val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5)
 			p2 = "Div 5";
-- 
2.18.0

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

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

* [PATCH i-g-t 4/7] Fix truncate string in the snprintf
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following GCC warning:

intel_reg.c: In function ‘dump_decode’:
warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
   snprintf(decode, sizeof(decode), "\n%s", bin);
intel_reg.c:203:3: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
[..]

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

diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index ddff2794..15ebb86a 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -180,7 +180,7 @@ static void to_binary(char *buf, size_t buflen, uint32_t val)
 
 static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
 {
-	char decode[1024];
+	char decode[2060];
 	char tmp[1024];
 	char bin[1024];
 
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 4/7] Fix truncate string in the snprintf
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patch fix the following GCC warning:

intel_reg.c: In function ‘dump_decode’:
warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
   snprintf(decode, sizeof(decode), "\n%s", bin);
intel_reg.c:203:3: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
[..]

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

diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index ddff2794..15ebb86a 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -180,7 +180,7 @@ static void to_binary(char *buf, size_t buflen, uint32_t val)
 
 static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
 {
-	char decode[1024];
+	char decode[2060];
 	char tmp[1024];
 	char bin[1024];
 
-- 
2.18.0

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

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

* [PATCH i-g-t 5/7] Make string commands dynamic allocate
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following GCC warning:

intel_gvtg_test.c: In function ‘create_guest’:
intel_gvtg_test.c:127:50: warning: ‘%s’ directive writing up to 4095
bytes into a region of size 4077 [-Wformat-overflow=]
[..]
intel_gvtg_test.c:127:5: note: ‘sprintf’ output between 36 and 8226
bytes into a destination of size 4096
[..]

This patch changes the approach for allocating memory to handle QEMU
commands by dynamically allocate space to save the whole command.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tools/intel_gvtg_test.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
index 659b7956..93c05e37 100644
--- a/tools/intel_gvtg_test.c
+++ b/tools/intel_gvtg_test.c
@@ -120,16 +120,25 @@ static int check_tools(void)
 
 static void create_guest(void)
 {
-    char create_qcow_cmd[PATH_MAX] = {0};
-    char create_vgpu_cmd[PATH_MAX] = {0};
-    char create_instance_cmd[PATH_MAX] = {0};
+    unsigned int max_size_cmd = sysconf(_SC_ARG_MAX);
+    char *command;
 
-    sprintf(create_qcow_cmd, "qemu-img create -b %s -f qcow2 %s.qcow2",
+    command = malloc(max_size_cmd);
+    if (!command)
+        return;
+
+    sprintf(command, "qemu-img create -b %s -f qcow2 %s.qcow2",
             hda_path, hda_path);
-    sprintf(create_vgpu_cmd, "echo \"%s\" > /sys/bus/pci/devices/0000:00:02.0/"
+    igt_assert_eq(system(command), 0);
+    memset(command, 0, max_size_cmd);
+
+    sprintf(command, "echo \"%s\" > /sys/bus/pci/devices/0000:00:02.0/"
            "mdev_supported_types/$(ls /sys/bus/pci/devices/0000:00:02.0/"
            "mdev_supported_types |awk {'print $1'}|tail -1)/create", uuid);
-    sprintf(create_instance_cmd, "%s -m 2048 -smp 2 -M pc -name gvtg_guest"
+    igt_assert_eq(system(command), 0);
+    memset(command, 0, max_size_cmd);
+
+    sprintf(command, "%s -m 2048 -smp 2 -M pc -name gvtg_guest"
            " -hda %s.qcow2 -bios %s -enable-kvm --net nic,macaddr=%s -net"
            " tap,script=/etc/qemu-ifup -vga cirrus -k en-us"
            " -serial stdio -vnc :1 -machine kernel_irqchip=on -global"
@@ -137,9 +146,9 @@ static void create_guest(void)
            " -usb -usbdevice tablet -device vfio-pci,sysfsdev="
            "/sys/bus/pci/devices/0000:00:02.0/%s &",
            qemu_path, hda_path, bios_path, mac_addr, uuid);
-    igt_assert_eq(system(create_qcow_cmd), 0);
-    igt_assert_eq(system(create_vgpu_cmd), 0);
-    igt_assert_eq(system(create_instance_cmd), 0);
+    igt_assert_eq(system(command), 0);
+
+    free(command);
 }
 
 static void destroy_all_guest(void)
-- 
2.18.0

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

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

* [Intel-gfx] [PATCH i-g-t 5/7] Make string commands dynamic allocate
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following GCC warning:

intel_gvtg_test.c: In function ‘create_guest’:
intel_gvtg_test.c:127:50: warning: ‘%s’ directive writing up to 4095
bytes into a region of size 4077 [-Wformat-overflow=]
[..]
intel_gvtg_test.c:127:5: note: ‘sprintf’ output between 36 and 8226
bytes into a destination of size 4096
[..]

This patch changes the approach for allocating memory to handle QEMU
commands by dynamically allocate space to save the whole command.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tools/intel_gvtg_test.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
index 659b7956..93c05e37 100644
--- a/tools/intel_gvtg_test.c
+++ b/tools/intel_gvtg_test.c
@@ -120,16 +120,25 @@ static int check_tools(void)
 
 static void create_guest(void)
 {
-    char create_qcow_cmd[PATH_MAX] = {0};
-    char create_vgpu_cmd[PATH_MAX] = {0};
-    char create_instance_cmd[PATH_MAX] = {0};
+    unsigned int max_size_cmd = sysconf(_SC_ARG_MAX);
+    char *command;
 
-    sprintf(create_qcow_cmd, "qemu-img create -b %s -f qcow2 %s.qcow2",
+    command = malloc(max_size_cmd);
+    if (!command)
+        return;
+
+    sprintf(command, "qemu-img create -b %s -f qcow2 %s.qcow2",
             hda_path, hda_path);
-    sprintf(create_vgpu_cmd, "echo \"%s\" > /sys/bus/pci/devices/0000:00:02.0/"
+    igt_assert_eq(system(command), 0);
+    memset(command, 0, max_size_cmd);
+
+    sprintf(command, "echo \"%s\" > /sys/bus/pci/devices/0000:00:02.0/"
            "mdev_supported_types/$(ls /sys/bus/pci/devices/0000:00:02.0/"
            "mdev_supported_types |awk {'print $1'}|tail -1)/create", uuid);
-    sprintf(create_instance_cmd, "%s -m 2048 -smp 2 -M pc -name gvtg_guest"
+    igt_assert_eq(system(command), 0);
+    memset(command, 0, max_size_cmd);
+
+    sprintf(command, "%s -m 2048 -smp 2 -M pc -name gvtg_guest"
            " -hda %s.qcow2 -bios %s -enable-kvm --net nic,macaddr=%s -net"
            " tap,script=/etc/qemu-ifup -vga cirrus -k en-us"
            " -serial stdio -vnc :1 -machine kernel_irqchip=on -global"
@@ -137,9 +146,9 @@ static void create_guest(void)
            " -usb -usbdevice tablet -device vfio-pci,sysfsdev="
            "/sys/bus/pci/devices/0000:00:02.0/%s &",
            qemu_path, hda_path, bios_path, mac_addr, uuid);
-    igt_assert_eq(system(create_qcow_cmd), 0);
-    igt_assert_eq(system(create_vgpu_cmd), 0);
-    igt_assert_eq(system(create_instance_cmd), 0);
+    igt_assert_eq(system(command), 0);
+
+    free(command);
 }
 
 static void destroy_all_guest(void)
-- 
2.18.0

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

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

* [PATCH i-g-t 6/7] Fix truncate string in the strncpy
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patch fix the following GCC Warnings:

warning: ‘strncpy’ output truncated before terminating nul copying 36
bytes from a string of the same length [-Wstringop-truncation]
[..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tests/perf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/perf.c b/tests/perf.c
index 95048bfa..031bcee8 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -3693,7 +3693,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* invalid mux_regs */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(invalid_mux_regs);
 	config.n_boolean_regs = 0;
@@ -3702,7 +3702,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* empty config */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 0;
 	config.mux_regs_ptr = to_user_pointer(mux_regs);
 	config.n_boolean_regs = 0;
@@ -3711,7 +3711,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* empty config with null pointers */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(NULL);
 	config.n_boolean_regs = 2;
@@ -3722,7 +3722,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* invalid pointers */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 42;
 	config.mux_regs_ptr = to_user_pointer((void *) 0xDEADBEEF);
 	config.n_boolean_regs = 0;
@@ -3809,7 +3809,7 @@ test_create_destroy_userspace_config(void)
 		i915_perf_remove_config(drm_fd, config_id);
 
 	memset(&config, 0, sizeof(config));
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(mux_regs);
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 6/7] Fix truncate string in the strncpy
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patch fix the following GCC Warnings:

warning: ‘strncpy’ output truncated before terminating nul copying 36
bytes from a string of the same length [-Wstringop-truncation]
[..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tests/perf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/perf.c b/tests/perf.c
index 95048bfa..031bcee8 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -3693,7 +3693,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* invalid mux_regs */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(invalid_mux_regs);
 	config.n_boolean_regs = 0;
@@ -3702,7 +3702,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* empty config */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 0;
 	config.mux_regs_ptr = to_user_pointer(mux_regs);
 	config.n_boolean_regs = 0;
@@ -3711,7 +3711,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* empty config with null pointers */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(NULL);
 	config.n_boolean_regs = 2;
@@ -3722,7 +3722,7 @@ test_invalid_create_userspace_config(void)
 	igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
 
 	/* invalid pointers */
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 	config.n_mux_regs = 42;
 	config.mux_regs_ptr = to_user_pointer((void *) 0xDEADBEEF);
 	config.n_boolean_regs = 0;
@@ -3809,7 +3809,7 @@ test_create_destroy_userspace_config(void)
 		i915_perf_remove_config(drm_fd, config_id);
 
 	memset(&config, 0, sizeof(config));
-	strncpy(config.uuid, uuid, sizeof(config.uuid));
+	strncpy(config.uuid, uuid, strlen(config.uuid));
 
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(mux_regs);
-- 
2.18.0

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

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

* [PATCH i-g-t 7/7] Avoid truncate string in __igt_lsof_fds
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 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 commit fixes this problem by changing the string size passed by
__igt_lsoft to __igt_lsof_fds. The max size for the string is
strlen("/proc/%d/cwd")+1 where "%d" can be estimated with
CEILING(LOG_10(INT_MAX)), in this sense, it is safe to define a path
size of 30 characters.

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 ca8ccfbd..d9dbf7ce 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1485,7 +1485,7 @@ __igt_lsof(const char *dir)
 	PROCTAB *proc;
 	proc_t *proc_info;
 
-	char path[PATH_MAX];
+	char path[30];
 	char *name_lnk;
 	struct stat st;
 	int state = 0;
-- 
2.18.0

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

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

* [Intel-gfx] [PATCH i-g-t 7/7] Avoid truncate string in __igt_lsof_fds
@ 2018-07-07 23:23   ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:23 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 commit fixes this problem by changing the string size passed by
__igt_lsoft to __igt_lsof_fds. The max size for the string is
strlen("/proc/%d/cwd")+1 where "%d" can be estimated with
CEILING(LOG_10(INT_MAX)), in this sense, it is safe to define a path
size of 30 characters.

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 ca8ccfbd..d9dbf7ce 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1485,7 +1485,7 @@ __igt_lsof(const char *dir)
 	PROCTAB *proc;
 	proc_t *proc_info;
 
-	char path[PATH_MAX];
+	char path[30];
 	char *name_lnk;
 	struct stat st;
 	int state = 0;
-- 
2.18.0

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for GCC warning cleanup
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
                   ` (7 preceding siblings ...)
  (?)
@ 2018-07-07 23:46 ` Patchwork
  -1 siblings, 0 replies; 34+ messages in thread
From: Patchwork @ 2018-07-07 23:46 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: GCC warning cleanup
URL   : https://patchwork.freedesktop.org/series/46119/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4445 -> IGTPW_1542 =

== Summary - SUCCESS ==

  No regressions found.

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

== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       PASS -> DMESG-WARN (fdo#107139, fdo#105128)

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-kbl-r:           PASS -> DMESG-WARN (fdo#105602) +1

    igt@kms_frontbuffer_tracking@basic:
      fi-bxt-j4205:       PASS -> FAIL (fdo#103167)
      fi-skl-6700hq:      PASS -> FAIL (fdo#103167)
      fi-bxt-dsi:         PASS -> FAIL (fdo#103167)
      fi-skl-6700k2:      PASS -> FAIL (fdo#103167)
      fi-kbl-7560u:       PASS -> FAIL (fdo#103167)
      fi-skl-6600u:       PASS -> FAIL (fdo#103167)
      fi-kbl-r:           PASS -> FAIL (fdo#103167)
      {fi-cfl-8109u}:     NOTRUN -> FAIL (fdo#103167)
      fi-skl-6260u:       PASS -> FAIL (fdo#103167)
      fi-skl-6770hq:      PASS -> FAIL (fdo#103167)
      fi-cfl-guc:         PASS -> FAIL (fdo#103167)
      fi-cfl-s3:          PASS -> FAIL (fdo#103167)
      fi-whl-u:           PASS -> FAIL (fdo#103167)
      fi-cfl-8700k:       PASS -> FAIL (fdo#103167)
      fi-kbl-7500u:       PASS -> FAIL (fdo#103167)
      fi-kbl-7567u:       PASS -> FAIL (fdo#103167)
      fi-skl-guc:         PASS -> FAIL (fdo#103167)
      fi-glk-j4005:       PASS -> FAIL (fdo#103167)
      fi-glk-dsi:         PASS -> FAIL (fdo#103167)
      fi-skl-gvtdvm:      PASS -> FAIL (fdo#103167)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      {fi-cfl-8109u}:     INCOMPLETE -> PASS

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

  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139


== Participating hosts (47 -> 41) ==

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-8809g 


== Build changes ==

    * IGT: IGT_4540 -> IGTPW_1542

  CI_DRM_4445: 366234e5605ce58f732d2aeb83c713dde6b7c85c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1542: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1542/
  IGT_4540: 78071c2fa53db2f04b8eddc6e6118be4fbc5c2fe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* [igt-dev] ✗ Fi.CI.IGT: failure for GCC warning cleanup
  2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
                   ` (8 preceding siblings ...)
  (?)
@ 2018-07-08  6:55 ` Patchwork
  -1 siblings, 0 replies; 34+ messages in thread
From: Patchwork @ 2018-07-08  6:55 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: GCC warning cleanup
URL   : https://patchwork.freedesktop.org/series/46119/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4540_full -> IGTPW_1542_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1542_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1542_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/46119/revisions/1/mbox/

== Possible new issues ==

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

  === IGT changes ===

    ==== Possible regressions ====

    igt@kms_plane@pixel-format-pipe-b-planes:
      shard-kbl:          PASS -> CRASH +7

    igt@kms_plane_scaling@pipe-a-scaler-with-clipping-clamping:
      shard-glk:          PASS -> CRASH +10

    igt@perf@create-destroy-userspace-config:
      shard-glk:          PASS -> FAIL +6
      shard-apl:          PASS -> FAIL +3
      shard-hsw:          PASS -> FAIL +1

    igt@perf@invalid-create-userspace-config:
      shard-kbl:          PASS -> FAIL +3

    
    ==== Warnings ====

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

    igt@gem_tiled_swapping@non-threaded:
      shard-hsw:          PASS -> SKIP

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_gtt:
      shard-glk:          PASS -> FAIL (fdo#105347, fdo#107127)

    igt@gem_ctx_isolation@vecs0-s3:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@gem_exec_basic@basic-bsd:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_draw_crc@draw-method-xrgb2101010-render-untiled:
      shard-apl:          PASS -> FAIL (fdo#103184) +2

    igt@kms_draw_crc@draw-method-xrgb2101010-render-xtiled:
      shard-kbl:          PASS -> FAIL (fdo#103184) +2

    igt@kms_draw_crc@draw-method-xrgb8888-render-ytiled:
      shard-apl:          PASS -> FAIL (fdo#103232)
      shard-glk:          PASS -> FAIL (fdo#103232)
      shard-kbl:          PASS -> FAIL (fdo#103232)

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

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render:
      shard-apl:          PASS -> FAIL (fdo#103167) +5

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
      shard-kbl:          PASS -> FAIL (fdo#103167) +5

    igt@kms_frontbuffer_tracking@fbc-2p-pri-indfb-multidraw:
      shard-glk:          PASS -> FAIL (fdo#103167) +10

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

    
    ==== Possible fixes ====

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

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

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

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

    igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

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

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

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  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#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
  fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
  fdo#107127 https://bugs.freedesktop.org/show_bug.cgi?id=107127
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  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_4540 -> IGTPW_1542
    * Linux: CI_DRM_4443 -> CI_DRM_4445

  CI_DRM_4443: 5c43ea095bbd1469a9c767529537ddf0434acc60 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4445: 366234e5605ce58f732d2aeb83c713dde6b7c85c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1542: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1542/
  IGT_4540: 78071c2fa53db2f04b8eddc6e6118be4fbc5c2fe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* Re: [PATCH i-g-t 1/7] Remove parameter aliases with another argument
  2018-07-07 23:22   ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-10 13:50     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 13:50 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:22:25PM -0300, Rodrigo Siqueira wrote:
> This commit fixes the following GCC warning:
> 
> warning: passing argument 2 to restrict-qualified parameter aliases with
> argument 1 [-Wrestrict]
>   return (readlink (buf, buf, sizeof (buf)) != -1 &&
> 
> This commit fixes the GCC warning by creating a second buffer only to
> keep the path.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 3313050c..fa22f12d 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1169,10 +1169,10 @@ bool igt_can_fail(void)
>  
>  static bool run_under_gdb(void)
>  {
> -	char buf[1024];
> +	char pathname[1024], buf[1024];

1024 for pathname is quite an overshoot. We stash at most
"/proc/%d/exec" where %d should be at most 21 or so.

> -	sprintf(buf, "/proc/%d/exe", getppid());
> -	return (readlink (buf, buf, sizeof (buf)) != -1 &&
> +	sprintf(pathname, "/proc/%d/exe", getppid());
> +	return (readlink (pathname, buf, sizeof (buf)) != -1 &&

                        ^ while we are here we can get rid of that space

>  		strncmp(basename(buf), "gdb", 3) == 0);
>  }
>  
> -- 
> 2.18.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH i-g-t 1/7] Remove parameter aliases with another argument
@ 2018-07-10 13:50     ` Arkadiusz Hiler
  0 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 13:50 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:22:25PM -0300, Rodrigo Siqueira wrote:
> This commit fixes the following GCC warning:
> 
> warning: passing argument 2 to restrict-qualified parameter aliases with
> argument 1 [-Wrestrict]
>   return (readlink (buf, buf, sizeof (buf)) != -1 &&
> 
> This commit fixes the GCC warning by creating a second buffer only to
> keep the path.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 3313050c..fa22f12d 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1169,10 +1169,10 @@ bool igt_can_fail(void)
>  
>  static bool run_under_gdb(void)
>  {
> -	char buf[1024];
> +	char pathname[1024], buf[1024];

1024 for pathname is quite an overshoot. We stash at most
"/proc/%d/exec" where %d should be at most 21 or so.

> -	sprintf(buf, "/proc/%d/exe", getppid());
> -	return (readlink (buf, buf, sizeof (buf)) != -1 &&
> +	sprintf(pathname, "/proc/%d/exe", getppid());
> +	return (readlink (pathname, buf, sizeof (buf)) != -1 &&

                        ^ while we are here we can get rid of that space

>  		strncmp(basename(buf), "gdb", 3) == 0);
>  }
>  
> -- 
> 2.18.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-07 23:22   ` [Intel-gfx] " Rodrigo Siqueira
@ 2018-07-10 13:58     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 13:58 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> This commit fixes the GCC warning:
> 
> warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
>      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
>                 ^
> warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
>      memset(ptr + offsets[1], 0x80,
> 
> This commit cast the ptr pointer, which is a void *, to uint32_t * in
> the pointer arithmetic operation.

This will change semantics, as according to GNU C standard[1], void
pointers have a size of 1 for all arithmetical purposes.

So you should be using uint8_t (or char) pointer instead.

[1]: http://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_fb.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ca905038 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -410,9 +410,11 @@ static int create_bo_for_fb(int fd, int width, int height,
>  
>  			switch (format->drm_id) {
>  			case DRM_FORMAT_NV12:
> -				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> +				memset(((uint32_t *)ptr) + offsets[0],
> +				       full_range ? 0x00 : 0x10,
>  				       calculated_stride * height);
> -				memset(ptr + offsets[1], 0x80,
> +				memset(((uint32_t *)ptr) + offsets[1],
> +				       0x80,
>  				       calculated_stride * height/2);
>  				break;
>  			case DRM_FORMAT_YUYV:
> -- 
> 2.18.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-10 13:58     ` Arkadiusz Hiler
  0 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 13:58 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, gustavo, intel-gfx

On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> This commit fixes the GCC warning:
> 
> warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
>      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
>                 ^
> warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
>      memset(ptr + offsets[1], 0x80,
> 
> This commit cast the ptr pointer, which is a void *, to uint32_t * in
> the pointer arithmetic operation.

This will change semantics, as according to GNU C standard[1], void
pointers have a size of 1 for all arithmetical purposes.

So you should be using uint8_t (or char) pointer instead.

[1]: http://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/igt_fb.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ca905038 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -410,9 +410,11 @@ static int create_bo_for_fb(int fd, int width, int height,
>  
>  			switch (format->drm_id) {
>  			case DRM_FORMAT_NV12:
> -				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> +				memset(((uint32_t *)ptr) + offsets[0],
> +				       full_range ? 0x00 : 0x10,
>  				       calculated_stride * height);
> -				memset(ptr + offsets[1], 0x80,
> +				memset(((uint32_t *)ptr) + offsets[1],
> +				       0x80,
>  				       calculated_stride * height/2);
>  				break;
>  			case DRM_FORMAT_YUYV:
> -- 
> 2.18.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 4/7] Fix truncate string in the snprintf
  2018-07-07 23:23   ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-10 14:07     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 14:07 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:23:17PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following GCC warning:
> 
> intel_reg.c: In function ‘dump_decode’:
> warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
>    snprintf(decode, sizeof(decode), "\n%s", bin);
> intel_reg.c:203:3: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
> [..]

That's an odd error.

Line 203:
	snprintf(decode, sizeof(decode), "\n%s", bin);

man snprintf states:
	The functions snprintf() and vsnprintf() write at most size
	bytes (including the terminating null byte ('\0')) to str.

So this should be truncated correctly. Am I missing something?

I'll set up gcc 8.1 tomorrow and poke around.

> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  tools/intel_reg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> index ddff2794..15ebb86a 100644
> --- a/tools/intel_reg.c
> +++ b/tools/intel_reg.c
> @@ -180,7 +180,7 @@ static void to_binary(char *buf, size_t buflen, uint32_t val)
>  
>  static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
>  {
> -	char decode[1024];
> +	char decode[2060];
>  	char tmp[1024];
>  	char bin[1024];
>  
> -- 
> 2.18.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 4/7] Fix truncate string in the snprintf
@ 2018-07-10 14:07     ` Arkadiusz Hiler
  0 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 14:07 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, gustavo, intel-gfx

On Sat, Jul 07, 2018 at 08:23:17PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following GCC warning:
> 
> intel_reg.c: In function ‘dump_decode’:
> warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
>    snprintf(decode, sizeof(decode), "\n%s", bin);
> intel_reg.c:203:3: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
> [..]

That's an odd error.

Line 203:
	snprintf(decode, sizeof(decode), "\n%s", bin);

man snprintf states:
	The functions snprintf() and vsnprintf() write at most size
	bytes (including the terminating null byte ('\0')) to str.

So this should be truncated correctly. Am I missing something?

I'll set up gcc 8.1 tomorrow and poke around.

> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  tools/intel_reg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> index ddff2794..15ebb86a 100644
> --- a/tools/intel_reg.c
> +++ b/tools/intel_reg.c
> @@ -180,7 +180,7 @@ static void to_binary(char *buf, size_t buflen, uint32_t val)
>  
>  static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
>  {
> -	char decode[1024];
> +	char decode[2060];
>  	char tmp[1024];
>  	char bin[1024];
>  
> -- 
> 2.18.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-10 13:58     ` [igt-dev] " Arkadiusz Hiler
@ 2018-07-10 14:09       ` Chris Wilson
  -1 siblings, 0 replies; 34+ messages in thread
From: Chris Wilson @ 2018-07-10 14:09 UTC (permalink / raw)
  To: Arkadiusz Hiler, Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > This commit fixes the GCC warning:
> > 
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> >                 ^
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> >      memset(ptr + offsets[1], 0x80,
> > 
> > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > the pointer arithmetic operation.
> 
> This will change semantics, as according to GNU C standard[1], void
> pointers have a size of 1 for all arithmetical purposes.
> 
> So you should be using uint8_t (or char) pointer instead.

Please just fix the compiler flags, we want close compatibility with the
kernel coding standards which explicitly allow void arithmetic for the
simplicity it lends to writing code.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-10 14:09       ` Chris Wilson
  0 siblings, 0 replies; 34+ messages in thread
From: Chris Wilson @ 2018-07-10 14:09 UTC (permalink / raw)
  To: Arkadiusz Hiler, Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > This commit fixes the GCC warning:
> > 
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> >                 ^
> > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> >      memset(ptr + offsets[1], 0x80,
> > 
> > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > the pointer arithmetic operation.
> 
> This will change semantics, as according to GNU C standard[1], void
> pointers have a size of 1 for all arithmetical purposes.
> 
> So you should be using uint8_t (or char) pointer instead.

Please just fix the compiler flags, we want close compatibility with the
kernel coding standards which explicitly allow void arithmetic for the
simplicity it lends to writing code.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-10 14:09       ` [Intel-gfx] " Chris Wilson
@ 2018-07-10 14:38         ` Arkadiusz Hiler
  -1 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 14:38 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx, Rodrigo Siqueira

On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > This commit fixes the GCC warning:
> > > 
> > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > >                 ^
> > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > >      memset(ptr + offsets[1], 0x80,
> > > 
> > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > the pointer arithmetic operation.
> > 
> > This will change semantics, as according to GNU C standard[1], void
> > pointers have a size of 1 for all arithmetical purposes.
> > 
> > So you should be using uint8_t (or char) pointer instead.
> 
> Please just fix the compiler flags, we want close compatibility with the
> kernel coding standards which explicitly allow void arithmetic for the
> simplicity it lends to writing code.
> -Chris

Fair point.

We don't rise the error with meson, so it is not a change in the gcc
defaults. Somehow autotools manage to end up adding -Wpointer-arith to
BASE_CFLAGS.

I don't think we should invest time into making autotools behave, since
it's going to be dropped completely. Hopefully this will happen sooner
than later.

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

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-10 14:38         ` Arkadiusz Hiler
  0 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-10 14:38 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, gustavo, intel-gfx, Rodrigo Siqueira

On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > This commit fixes the GCC warning:
> > > 
> > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > >                 ^
> > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > >      memset(ptr + offsets[1], 0x80,
> > > 
> > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > the pointer arithmetic operation.
> > 
> > This will change semantics, as according to GNU C standard[1], void
> > pointers have a size of 1 for all arithmetical purposes.
> > 
> > So you should be using uint8_t (or char) pointer instead.
> 
> Please just fix the compiler flags, we want close compatibility with the
> kernel coding standards which explicitly allow void arithmetic for the
> simplicity it lends to writing code.
> -Chris

Fair point.

We don't rise the error with meson, so it is not a change in the gcc
defaults. Somehow autotools manage to end up adding -Wpointer-arith to
BASE_CFLAGS.

I don't think we should invest time into making autotools behave, since
it's going to be dropped completely. Hopefully this will happen sooner
than later.

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

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-10 14:38         ` Arkadiusz Hiler
@ 2018-07-10 14:43           ` Chris Wilson
  -1 siblings, 0 replies; 34+ messages in thread
From: Chris Wilson @ 2018-07-10 14:43 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, intel-gfx, Rodrigo Siqueira

Quoting Arkadiusz Hiler (2018-07-10 15:38:26)
> On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> > Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > > This commit fixes the GCC warning:
> > > > 
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > > >                 ^
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[1], 0x80,
> > > > 
> > > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > > the pointer arithmetic operation.
> > > 
> > > This will change semantics, as according to GNU C standard[1], void
> > > pointers have a size of 1 for all arithmetical purposes.
> > > 
> > > So you should be using uint8_t (or char) pointer instead.
> > 
> > Please just fix the compiler flags, we want close compatibility with the
> > kernel coding standards which explicitly allow void arithmetic for the
> > simplicity it lends to writing code.
> > -Chris
> 
> Fair point.
> 
> We don't rise the error with meson, so it is not a change in the gcc
> defaults. Somehow autotools manage to end up adding -Wpointer-arith to
> BASE_CFLAGS.

iirc, it's pulled in from xorg-macros. Maybe just tack a
-Wnopointer-arith onto the end, or sed away.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-10 14:43           ` Chris Wilson
  0 siblings, 0 replies; 34+ messages in thread
From: Chris Wilson @ 2018-07-10 14:43 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, intel-gfx, Rodrigo Siqueira

Quoting Arkadiusz Hiler (2018-07-10 15:38:26)
> On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> > Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > > This commit fixes the GCC warning:
> > > > 
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > > >                 ^
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[1], 0x80,
> > > > 
> > > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > > the pointer arithmetic operation.
> > > 
> > > This will change semantics, as according to GNU C standard[1], void
> > > pointers have a size of 1 for all arithmetical purposes.
> > > 
> > > So you should be using uint8_t (or char) pointer instead.
> > 
> > Please just fix the compiler flags, we want close compatibility with the
> > kernel coding standards which explicitly allow void arithmetic for the
> > simplicity it lends to writing code.
> > -Chris
> 
> Fair point.
> 
> We don't rise the error with meson, so it is not a change in the gcc
> defaults. Somehow autotools manage to end up adding -Wpointer-arith to
> BASE_CFLAGS.

iirc, it's pulled in from xorg-macros. Maybe just tack a
-Wnopointer-arith onto the end, or sed away.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
  2018-07-10 14:38         ` Arkadiusz Hiler
@ 2018-07-11  1:58           ` Rodrigo Siqueira
  -1 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-11  1:58 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Hi,

Thanks for the feedback,

I'm just a little bit confused about the next step here. Is it worth to
fix this patch and the others? I got confused since you said that IGT
will remove autotools and some of the warnings here does not appear on
meson.

Best Regards
Rodrigo Siqueira

On 07/10, Arkadiusz Hiler wrote:
> On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> > Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > > This commit fixes the GCC warning:
> > > > 
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > > >                 ^
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[1], 0x80,
> > > > 
> > > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > > the pointer arithmetic operation.
> > > 
> > > This will change semantics, as according to GNU C standard[1], void
> > > pointers have a size of 1 for all arithmetical purposes.
> > > 
> > > So you should be using uint8_t (or char) pointer instead.
> > 
> > Please just fix the compiler flags, we want close compatibility with the
> > kernel coding standards which explicitly allow void arithmetic for the
> > simplicity it lends to writing code.
> > -Chris
> 
> Fair point.
> 
> We don't rise the error with meson, so it is not a change in the gcc
> defaults. Somehow autotools manage to end up adding -Wpointer-arith to
> BASE_CFLAGS.
> 
> I don't think we should invest time into making autotools behave, since
> it's going to be dropped completely. Hopefully this will happen sooner
> than later.
> 
> -- 
> Cheers,
> Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t*
@ 2018-07-11  1:58           ` Rodrigo Siqueira
  0 siblings, 0 replies; 34+ messages in thread
From: Rodrigo Siqueira @ 2018-07-11  1:58 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

Hi,

Thanks for the feedback,

I'm just a little bit confused about the next step here. Is it worth to
fix this patch and the others? I got confused since you said that IGT
will remove autotools and some of the warnings here does not appear on
meson.

Best Regards
Rodrigo Siqueira

On 07/10, Arkadiusz Hiler wrote:
> On Tue, Jul 10, 2018 at 03:09:25PM +0100, Chris Wilson wrote:
> > Quoting Arkadiusz Hiler (2018-07-10 14:58:49)
> > > On Sat, Jul 07, 2018 at 08:22:38PM -0300, Rodrigo Siqueira wrote:
> > > > This commit fixes the GCC warning:
> > > > 
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
> > > >                 ^
> > > > warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
> > > >      memset(ptr + offsets[1], 0x80,
> > > > 
> > > > This commit cast the ptr pointer, which is a void *, to uint32_t * in
> > > > the pointer arithmetic operation.
> > > 
> > > This will change semantics, as according to GNU C standard[1], void
> > > pointers have a size of 1 for all arithmetical purposes.
> > > 
> > > So you should be using uint8_t (or char) pointer instead.
> > 
> > Please just fix the compiler flags, we want close compatibility with the
> > kernel coding standards which explicitly allow void arithmetic for the
> > simplicity it lends to writing code.
> > -Chris
> 
> Fair point.
> 
> We don't rise the error with meson, so it is not a change in the gcc
> defaults. Somehow autotools manage to end up adding -Wpointer-arith to
> BASE_CFLAGS.
> 
> I don't think we should invest time into making autotools behave, since
> it's going to be dropped completely. Hopefully this will happen sooner
> than later.
> 
> -- 
> Cheers,
> Arek
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 5/7] Make string commands dynamic allocate
  2018-07-07 23:23   ` [Intel-gfx] " Rodrigo Siqueira
@ 2018-07-11 12:26     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-11 12:26 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:23:30PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following GCC warning:
> 
> intel_gvtg_test.c: In function ‘create_guest’:
> intel_gvtg_test.c:127:50: warning: ‘%s’ directive writing up to 4095
> bytes into a region of size 4077 [-Wformat-overflow=]
> [..]
> intel_gvtg_test.c:127:5: note: ‘sprintf’ output between 36 and 8226
> bytes into a destination of size 4096
> [..]
> 
> This patch changes the approach for allocating memory to handle QEMU
> commands by dynamically allocate space to save the whole command.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  tools/intel_gvtg_test.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
> index 659b7956..93c05e37 100644
> --- a/tools/intel_gvtg_test.c
> +++ b/tools/intel_gvtg_test.c
> @@ -120,16 +120,25 @@ static int check_tools(void)
>  
>  static void create_guest(void)
>  {
> -    char create_qcow_cmd[PATH_MAX] = {0};
> -    char create_vgpu_cmd[PATH_MAX] = {0};
> -    char create_instance_cmd[PATH_MAX] = {0};
> +    unsigned int max_size_cmd = sysconf(_SC_ARG_MAX);

That's 2097152 on my system. Quite an overkill. I know that we have lazy
page table assigement, but memseting the whole 2GB defeats it.

The qemu invocation looks like  the longest one, and we have 3
components that may take up to PATH_MAX each and some extra stuff, so
going with 4*PATH_MAX should be enough.

BTW, why do you memset it to 0 before each sprintf?

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

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

* Re: [igt-dev] [PATCH i-g-t 5/7] Make string commands dynamic allocate
@ 2018-07-11 12:26     ` Arkadiusz Hiler
  0 siblings, 0 replies; 34+ messages in thread
From: Arkadiusz Hiler @ 2018-07-11 12:26 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, gustavo, intel-gfx

On Sat, Jul 07, 2018 at 08:23:30PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following GCC warning:
> 
> intel_gvtg_test.c: In function ‘create_guest’:
> intel_gvtg_test.c:127:50: warning: ‘%s’ directive writing up to 4095
> bytes into a region of size 4077 [-Wformat-overflow=]
> [..]
> intel_gvtg_test.c:127:5: note: ‘sprintf’ output between 36 and 8226
> bytes into a destination of size 4096
> [..]
> 
> This patch changes the approach for allocating memory to handle QEMU
> commands by dynamically allocate space to save the whole command.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  tools/intel_gvtg_test.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
> index 659b7956..93c05e37 100644
> --- a/tools/intel_gvtg_test.c
> +++ b/tools/intel_gvtg_test.c
> @@ -120,16 +120,25 @@ static int check_tools(void)
>  
>  static void create_guest(void)
>  {
> -    char create_qcow_cmd[PATH_MAX] = {0};
> -    char create_vgpu_cmd[PATH_MAX] = {0};
> -    char create_instance_cmd[PATH_MAX] = {0};
> +    unsigned int max_size_cmd = sysconf(_SC_ARG_MAX);

That's 2097152 on my system. Quite an overkill. I know that we have lazy
page table assigement, but memseting the whole 2GB defeats it.

The qemu invocation looks like  the longest one, and we have 3
components that may take up to PATH_MAX each and some extra stuff, so
going with 4*PATH_MAX should be enough.

BTW, why do you memset it to 0 before each sprintf?

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

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

end of thread, other threads:[~2018-07-11 12:26 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-07 23:22 [PATCH i-g-t 0/7] GCC warning cleanup Rodrigo Siqueira
2018-07-07 23:22 ` [igt-dev] " Rodrigo Siqueira
2018-07-07 23:22 ` [PATCH i-g-t 1/7] Remove parameter aliases with another argument Rodrigo Siqueira
2018-07-07 23:22   ` [igt-dev] " Rodrigo Siqueira
2018-07-10 13:50   ` Arkadiusz Hiler
2018-07-10 13:50     ` [Intel-gfx] " Arkadiusz Hiler
2018-07-07 23:22 ` [PATCH i-g-t 2/7] Cast void * pointer used in arithmetic to uint32_t* Rodrigo Siqueira
2018-07-07 23:22   ` [Intel-gfx] " Rodrigo Siqueira
2018-07-10 13:58   ` Arkadiusz Hiler
2018-07-10 13:58     ` [igt-dev] " Arkadiusz Hiler
2018-07-10 14:09     ` Chris Wilson
2018-07-10 14:09       ` [Intel-gfx] " Chris Wilson
2018-07-10 14:38       ` Arkadiusz Hiler
2018-07-10 14:38         ` Arkadiusz Hiler
2018-07-10 14:43         ` Chris Wilson
2018-07-10 14:43           ` [Intel-gfx] " Chris Wilson
2018-07-11  1:58         ` Rodrigo Siqueira
2018-07-11  1:58           ` Rodrigo Siqueira
2018-07-07 23:22 ` [PATCH i-g-t 3/7] Fix comparison that always evaluates to false Rodrigo Siqueira
2018-07-07 23:22   ` [igt-dev] " Rodrigo Siqueira
2018-07-07 23:23 ` [PATCH i-g-t 4/7] Fix truncate string in the snprintf Rodrigo Siqueira
2018-07-07 23:23   ` [igt-dev] " Rodrigo Siqueira
2018-07-10 14:07   ` Arkadiusz Hiler
2018-07-10 14:07     ` [igt-dev] " Arkadiusz Hiler
2018-07-07 23:23 ` [PATCH i-g-t 5/7] Make string commands dynamic allocate Rodrigo Siqueira
2018-07-07 23:23   ` [Intel-gfx] " Rodrigo Siqueira
2018-07-11 12:26   ` Arkadiusz Hiler
2018-07-11 12:26     ` [igt-dev] " Arkadiusz Hiler
2018-07-07 23:23 ` [PATCH i-g-t 6/7] Fix truncate string in the strncpy Rodrigo Siqueira
2018-07-07 23:23   ` [igt-dev] " Rodrigo Siqueira
2018-07-07 23:23 ` [PATCH i-g-t 7/7] Avoid truncate string in __igt_lsof_fds Rodrigo Siqueira
2018-07-07 23:23   ` [Intel-gfx] " Rodrigo Siqueira
2018-07-07 23:46 ` [igt-dev] ✓ Fi.CI.BAT: success for GCC warning cleanup Patchwork
2018-07-08  6:55 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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.