* [PATCH 1/3] drm: Don't create properties without names
@ 2018-03-02 13:25 Ville Syrjala
2018-03-02 13:25 ` [PATCH 2/3] drm: Check property/enum name length Ville Syrjala
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: Ville Syrjala @ 2018-03-02 13:25 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Creating a property that doesn't have a name makes no sense to me. Don't
allow it.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_property.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index bae50e6b819d..fe8627fb7ae6 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
property->num_values = num_values;
INIT_LIST_HEAD(&property->enum_list);
- if (name) {
- strncpy(property->name, name, DRM_PROP_NAME_LEN);
- property->name[DRM_PROP_NAME_LEN-1] = '\0';
- }
+ strncpy(property->name, name, DRM_PROP_NAME_LEN);
+ property->name[DRM_PROP_NAME_LEN-1] = '\0';
list_add_tail(&property->head, &dev->mode_config.property_list);
--
2.13.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] drm: Check property/enum name length
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
@ 2018-03-02 13:25 ` Ville Syrjala
2018-03-02 14:03 ` [PATCH v2 2/3 " Ville Syrjala
2018-03-02 13:25 ` [PATCH v2 3/3] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Ville Syrjala
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjala @ 2018-03-02 13:25 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reject requests to add properties/enums with an overly long name.
Previously we would have just silently truncated the string and exposed
it userspace.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_property.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index fe8627fb7ae6..f062adf21b9c 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -78,6 +78,9 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
struct drm_property *property = NULL;
int ret;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return -EINVAL;
+
property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
if (!property)
return NULL;
@@ -372,6 +375,9 @@ int drm_property_add_enum(struct drm_property *property, int index,
{
struct drm_property_enum *prop_enum;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return -EINVAL;
+
if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
return -EINVAL;
--
2.13.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/3] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
2018-03-02 13:25 ` [PATCH 2/3] drm: Check property/enum name length Ville Syrjala
@ 2018-03-02 13:25 ` Ville Syrjala
2018-03-02 13:58 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm: Don't create properties without names Patchwork
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjala @ 2018-03-02 13:25 UTC (permalink / raw)
To: dri-devel
Cc: intel-gfx, Russell King - ARM Linux, Hans Verkuil, Uma Shankar,
Jyri Sarha
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
BT.2020 specifies two YCbCr<->RGB conversion formulas. The more
traditional non-constant luminance and a more complicate constant
luminance one. Add an enum value for the constant luminance variant
as well in case someone has hardware supporting it.
v2: Reduce the enum name to fit within the 31 character uapi limit
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
CC: Uma Shankar <uma.shankar@intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Harry Wentland <harry.wentland@amd.com> #v1
---
drivers/gpu/drm/drm_color_mgmt.c | 1 +
include/drm/drm_color_mgmt.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index 4ff064623836..cc28c32399af 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -358,6 +358,7 @@ static const char * const color_encoding_name[] = {
[DRM_COLOR_YCBCR_BT601] = "ITU-R BT.601 YCbCr",
[DRM_COLOR_YCBCR_BT709] = "ITU-R BT.709 YCbCr",
[DRM_COLOR_YCBCR_BT2020] = "ITU-R BT.2020 YCbCr",
+ [DRM_COLOR_YCBCR_BT2020_CONST] = "ITU-R BT.2020 YCbCr const",
};
static const char * const color_range_name[] = {
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index b3b6d302ca8c..175943c87d5b 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -41,7 +41,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
enum drm_color_encoding {
DRM_COLOR_YCBCR_BT601,
DRM_COLOR_YCBCR_BT709,
- DRM_COLOR_YCBCR_BT2020,
+ DRM_COLOR_YCBCR_BT2020, /* non-constant luminance */
+ DRM_COLOR_YCBCR_BT2020_CONST, /* constant luminance */
DRM_COLOR_ENCODING_MAX,
};
--
2.13.6
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm: Don't create properties without names
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
2018-03-02 13:25 ` [PATCH 2/3] drm: Check property/enum name length Ville Syrjala
2018-03-02 13:25 ` [PATCH v2 3/3] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Ville Syrjala
@ 2018-03-02 13:58 ` Patchwork
2018-03-02 14:13 ` ✓ Fi.CI.BAT: success " Patchwork
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2018-03-02 13:58 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm: Don't create properties without names
URL : https://patchwork.freedesktop.org/series/39277/
State : warning
== Summary ==
$ dim sparse origin/drm-tip
Commit: drm: Don't create properties without names
Okay!
Commit: drm: Check property/enum name length
-
+ ^
+drivers/gpu/drm/drm_property.c:82:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
+drivers/gpu/drm/drm_property.c:82:24: expected struct drm_property *
+drivers/gpu/drm/drm_property.c:82:24: got int
+drivers/gpu/drm/drm_property.c:82:24: warning: incorrect type in return expression (different base types)
+drivers/gpu/drm/drm_property.c: In function ‘drm_property_create’:
+ return -EINVAL;
Commit: drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
Okay!
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 2/3 drm: Check property/enum name length
2018-03-02 13:25 ` [PATCH 2/3] drm: Check property/enum name length Ville Syrjala
@ 2018-03-02 14:03 ` Ville Syrjala
2018-03-06 10:22 ` [Intel-gfx] " Daniel Vetter
0 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjala @ 2018-03-02 14:03 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reject requests to add properties/enums with an overly long name.
Previously we would have just silently truncated the string and exposed
it userspace.
v2: drm_property_create() returns a pointer
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_property.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index fe8627fb7ae6..c37ac41125b5 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -78,6 +78,9 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
struct drm_property *property = NULL;
int ret;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return NULL;
+
property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
if (!property)
return NULL;
@@ -372,6 +375,9 @@ int drm_property_add_enum(struct drm_property *property, int index,
{
struct drm_property_enum *prop_enum;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return -EINVAL;
+
if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
return -EINVAL;
--
2.16.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Don't create properties without names
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
` (2 preceding siblings ...)
2018-03-02 13:58 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm: Don't create properties without names Patchwork
@ 2018-03-02 14:13 ` Patchwork
2018-03-02 14:55 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Don't create properties without names (rev2) Patchwork
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2018-03-02 14:13 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm: Don't create properties without names
URL : https://patchwork.freedesktop.org/series/39277/
State : success
== Summary ==
Series 39277v1 series starting with [1/3] drm: Don't create properties without names
https://patchwork.freedesktop.org/api/1.0/series/39277/revisions/1/mbox/
---- Known issues:
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:412s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:419s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:371s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:494s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:277s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:477s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:485s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:463s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:461s
fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:390s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:572s
fi-cfl-u total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:492s
fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:573s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:407s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:287s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:507s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:392s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:404s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:459s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:410s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:450s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:485s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:448s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:494s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:578s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:426s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:499s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:517s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:483s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:469s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:408s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:428s
fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:390s
7075ab436b3bb8b97dfde3eb16b2545398938f83 drm-tip: 2018y-03m-02d-13h-04m-00s UTC integration manifest
6b313f784de6 drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
c0ec45ad9801 drm: Check property/enum name length
7de598d791f9 drm: Don't create properties without names
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8214/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Don't create properties without names (rev2)
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
` (3 preceding siblings ...)
2018-03-02 14:13 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-03-02 14:55 ` Patchwork
2018-03-02 16:59 ` ✓ Fi.CI.IGT: " Patchwork
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2018-03-02 14:55 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm: Don't create properties without names (rev2)
URL : https://patchwork.freedesktop.org/series/39277/
State : success
== Summary ==
Series 39277v2 series starting with [1/3] drm: Don't create properties without names
https://patchwork.freedesktop.org/api/1.0/series/39277/revisions/2/mbox/
---- Known issues:
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-skl-6700k2) fdo#104108
Test prime_vgem:
Subgroup basic-fence-flip:
pass -> FAIL (fi-ilk-650) fdo#104008
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:417s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:423s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:376s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:478s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:277s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:480s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:466s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:456s
fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:395s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:569s
fi-cfl-u total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:488s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:413s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:289s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:504s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:386s
fi-ilk-650 total:288 pass:227 dwarn:0 dfail:0 fail:1 skip:60 time:407s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:442s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:409s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:450s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:490s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:448s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:491s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:578s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:426s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:498s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:517s
fi-skl-6700k2 total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:486s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:465s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:403s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:424s
fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:523s
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:392s
7075ab436b3bb8b97dfde3eb16b2545398938f83 drm-tip: 2018y-03m-02d-13h-04m-00s UTC integration manifest
0170b5d10306 drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
e643d887905b [PATCH v2 2/3 drm: Check property/enum name length
7a28ad7d5e5c drm: Don't create properties without names
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8216/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* ✓ Fi.CI.IGT: success for series starting with [1/3] drm: Don't create properties without names (rev2)
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
` (4 preceding siblings ...)
2018-03-02 14:55 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Don't create properties without names (rev2) Patchwork
@ 2018-03-02 16:59 ` Patchwork
2018-03-06 10:18 ` [PATCH 1/3] drm: Don't create properties without names Daniel Vetter
2018-03-06 13:35 ` [Intel-gfx] " Emil Velikov
7 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2018-03-02 16:59 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/3] drm: Don't create properties without names (rev2)
URL : https://patchwork.freedesktop.org/series/39277/
State : success
== Summary ==
---- Known issues:
Test kms_chv_cursor_fail:
Subgroup pipe-b-256x256-bottom-edge:
pass -> DMESG-WARN (shard-snb) fdo#105185 +2
Test kms_flip:
Subgroup 2x-flip-vs-expired-vblank:
pass -> FAIL (shard-hsw) fdo#102887
Subgroup plain-flip-fb-recreate-interruptible:
pass -> FAIL (shard-hsw) fdo#100368
fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
shard-apl total:3463 pass:1823 dwarn:1 dfail:0 fail:7 skip:1632 time:12511s
shard-hsw total:3463 pass:1768 dwarn:1 dfail:0 fail:3 skip:1690 time:12054s
shard-snb total:3463 pass:1360 dwarn:3 dfail:0 fail:1 skip:2099 time:6997s
Blacklisted hosts:
shard-kbl total:3401 pass:1906 dwarn:1 dfail:0 fail:7 skip:1485 time:9036s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8216/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] drm: Don't create properties without names
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
` (5 preceding siblings ...)
2018-03-02 16:59 ` ✓ Fi.CI.IGT: " Patchwork
@ 2018-03-06 10:18 ` Daniel Vetter
2018-03-06 13:35 ` [Intel-gfx] " Emil Velikov
7 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2018-03-06 10:18 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, dri-devel
On Fri, Mar 02, 2018 at 03:25:42PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Creating a property that doesn't have a name makes no sense to me. Don't
> allow it.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_property.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index bae50e6b819d..fe8627fb7ae6 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> property->num_values = num_values;
> INIT_LIST_HEAD(&property->enum_list);
>
> - if (name) {
> - strncpy(property->name, name, DRM_PROP_NAME_LEN);
> - property->name[DRM_PROP_NAME_LEN-1] = '\0';
> - }
> + strncpy(property->name, name, DRM_PROP_NAME_LEN);
> + property->name[DRM_PROP_NAME_LEN-1] = '\0';
>
> list_add_tail(&property->head, &dev->mode_config.property_list);
>
> --
> 2.13.6
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Intel-gfx] [PATCH v2 2/3 drm: Check property/enum name length
2018-03-02 14:03 ` [PATCH v2 2/3 " Ville Syrjala
@ 2018-03-06 10:22 ` Daniel Vetter
2018-03-06 11:50 ` Ville Syrjälä
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Vetter @ 2018-03-06 10:22 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, dri-devel
On Fri, Mar 02, 2018 at 04:03:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reject requests to add properties/enums with an overly long name.
> Previously we would have just silently truncated the string and exposed
> it userspace.
>
> v2: drm_property_create() returns a pointer
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
While you're typing validation code, I noticed that drm_property_add_enum
allows you to overwrite the name of an existing enum value already added.
That sounds like something we never want to allow either.
Anyway, this is
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_property.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index fe8627fb7ae6..c37ac41125b5 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -78,6 +78,9 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> struct drm_property *property = NULL;
> int ret;
>
> + if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
> + return NULL;
> +
> property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
> if (!property)
> return NULL;
> @@ -372,6 +375,9 @@ int drm_property_add_enum(struct drm_property *property, int index,
> {
> struct drm_property_enum *prop_enum;
>
> + if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
> + return -EINVAL;
> +
> if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
> drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
> return -EINVAL;
> --
> 2.16.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/3 drm: Check property/enum name length
2018-03-06 10:22 ` [Intel-gfx] " Daniel Vetter
@ 2018-03-06 11:50 ` Ville Syrjälä
0 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2018-03-06 11:50 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel
On Tue, Mar 06, 2018 at 11:22:54AM +0100, Daniel Vetter wrote:
> On Fri, Mar 02, 2018 at 04:03:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Reject requests to add properties/enums with an overly long name.
> > Previously we would have just silently truncated the string and exposed
> > it userspace.
> >
> > v2: drm_property_create() returns a pointer
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> While you're typing validation code, I noticed that drm_property_add_enum
> allows you to overwrite the name of an existing enum value already added.
> That sounds like something we never want to allow either.
Good point. I suppose we should just WARN and error out there as well?
>
> Anyway, this is
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> > ---
> > drivers/gpu/drm/drm_property.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> > index fe8627fb7ae6..c37ac41125b5 100644
> > --- a/drivers/gpu/drm/drm_property.c
> > +++ b/drivers/gpu/drm/drm_property.c
> > @@ -78,6 +78,9 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> > struct drm_property *property = NULL;
> > int ret;
> >
> > + if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
> > + return NULL;
> > +
> > property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
> > if (!property)
> > return NULL;
> > @@ -372,6 +375,9 @@ int drm_property_add_enum(struct drm_property *property, int index,
> > {
> > struct drm_property_enum *prop_enum;
> >
> > + if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
> > + return -EINVAL;
> > +
> > if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
> > drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
> > return -EINVAL;
> > --
> > 2.16.1
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Don't create properties without names
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
` (6 preceding siblings ...)
2018-03-06 10:18 ` [PATCH 1/3] drm: Don't create properties without names Daniel Vetter
@ 2018-03-06 13:35 ` Emil Velikov
2018-03-06 13:54 ` Ville Syrjälä
7 siblings, 1 reply; 14+ messages in thread
From: Emil Velikov @ 2018-03-06 13:35 UTC (permalink / raw)
To: Ville Syrjala; +Cc: intel-gfx, ML dri-devel
Hi Ville,
On 2 March 2018 at 13:25, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Creating a property that doesn't have a name makes no sense to me. Don't
> allow it.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/drm_property.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index bae50e6b819d..fe8627fb7ae6 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> property->num_values = num_values;
> INIT_LIST_HEAD(&property->enum_list);
>
> - if (name) {
> - strncpy(property->name, name, DRM_PROP_NAME_LEN);
> - property->name[DRM_PROP_NAME_LEN-1] = '\0';
> - }
> + strncpy(property->name, name, DRM_PROP_NAME_LEN);
> + property->name[DRM_PROP_NAME_LEN-1] = '\0';
>
Shouldn't one also a) error (WARN + return NULL) out when name is NULL
and b) update the documentation?
-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Don't create properties without names
2018-03-06 13:35 ` [Intel-gfx] " Emil Velikov
@ 2018-03-06 13:54 ` Ville Syrjälä
2018-03-06 15:41 ` Emil Velikov
0 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjälä @ 2018-03-06 13:54 UTC (permalink / raw)
To: Emil Velikov; +Cc: intel-gfx, ML dri-devel
On Tue, Mar 06, 2018 at 01:35:11PM +0000, Emil Velikov wrote:
> Hi Ville,
>
> On 2 March 2018 at 13:25, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Creating a property that doesn't have a name makes no sense to me. Don't
> > allow it.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > drivers/gpu/drm/drm_property.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> > index bae50e6b819d..fe8627fb7ae6 100644
> > --- a/drivers/gpu/drm/drm_property.c
> > +++ b/drivers/gpu/drm/drm_property.c
> > @@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> > property->num_values = num_values;
> > INIT_LIST_HEAD(&property->enum_list);
> >
> > - if (name) {
> > - strncpy(property->name, name, DRM_PROP_NAME_LEN);
> > - property->name[DRM_PROP_NAME_LEN-1] = '\0';
> > - }
> > + strncpy(property->name, name, DRM_PROP_NAME_LEN);
> > + property->name[DRM_PROP_NAME_LEN-1] = '\0';
> >
> Shouldn't one also a) error (WARN + return NULL) out when name is NULL
> and b) update the documentation?
The developer gets the oops. No point in further handholding IMO.
Didn't look at the docs us usual. Are they saying NULL is OK?
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] drm: Don't create properties without names
2018-03-06 13:54 ` Ville Syrjälä
@ 2018-03-06 15:41 ` Emil Velikov
0 siblings, 0 replies; 14+ messages in thread
From: Emil Velikov @ 2018-03-06 15:41 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: intel-gfx, ML dri-devel
On 6 March 2018 at 13:54, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Tue, Mar 06, 2018 at 01:35:11PM +0000, Emil Velikov wrote:
>> Hi Ville,
>>
>> On 2 March 2018 at 13:25, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> >
>> > Creating a property that doesn't have a name makes no sense to me. Don't
>> > allow it.
>> >
>> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> > ---
>> > drivers/gpu/drm/drm_property.c | 6 ++----
>> > 1 file changed, 2 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
>> > index bae50e6b819d..fe8627fb7ae6 100644
>> > --- a/drivers/gpu/drm/drm_property.c
>> > +++ b/drivers/gpu/drm/drm_property.c
>> > @@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
>> > property->num_values = num_values;
>> > INIT_LIST_HEAD(&property->enum_list);
>> >
>> > - if (name) {
>> > - strncpy(property->name, name, DRM_PROP_NAME_LEN);
>> > - property->name[DRM_PROP_NAME_LEN-1] = '\0';
>> > - }
>> > + strncpy(property->name, name, DRM_PROP_NAME_LEN);
>> > + property->name[DRM_PROP_NAME_LEN-1] = '\0';
>> >
>> Shouldn't one also a) error (WARN + return NULL) out when name is NULL
>> and b) update the documentation?
>
> The developer gets the oops. No point in further handholding IMO.
>
Gut feeling suggests that not everyone tests all their
drm_properly_create codepaths. So it's more of user gets an oops.
But that's another story ;-)
> Didn't look at the docs us usual. Are they saying NULL is OK?
>
The drm_property_create does not explicitly mention (allow?) NULL.
Yet again I don't recall any instances of the docs saying that, using
NULL is allowed/valid.
It's been a while since I read through the docs, so they might be updated.
Either way it was a simple fly-by suggestion.
-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-03-06 15:41 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-02 13:25 [PATCH 1/3] drm: Don't create properties without names Ville Syrjala
2018-03-02 13:25 ` [PATCH 2/3] drm: Check property/enum name length Ville Syrjala
2018-03-02 14:03 ` [PATCH v2 2/3 " Ville Syrjala
2018-03-06 10:22 ` [Intel-gfx] " Daniel Vetter
2018-03-06 11:50 ` Ville Syrjälä
2018-03-02 13:25 ` [PATCH v2 3/3] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Ville Syrjala
2018-03-02 13:58 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm: Don't create properties without names Patchwork
2018-03-02 14:13 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-02 14:55 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Don't create properties without names (rev2) Patchwork
2018-03-02 16:59 ` ✓ Fi.CI.IGT: " Patchwork
2018-03-06 10:18 ` [PATCH 1/3] drm: Don't create properties without names Daniel Vetter
2018-03-06 13:35 ` [Intel-gfx] " Emil Velikov
2018-03-06 13:54 ` Ville Syrjälä
2018-03-06 15:41 ` Emil Velikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).