Skip to contentSkip to conversation

Revert "mei: hdcp: Replace one-element array with flexible-array member"

char-misc-next Tomas Winkler 3 participants 13 messages Jul 28, 2020 – Jul 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.
I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
 drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
 	verify_mprime_in.k = cpu_to_be16(data->k);
 
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in {
 	u8				seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
Signature · 1 line
2.25.4
#1 lore raw

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

Thanks
--
Gustavo

Quoted 40 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
 drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
 	verify_mprime_in.k = cpu_to_be16(data->k);
 
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in {
 	u8				seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#2 lore raw
Quoted 12 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Wednesday, July 29, 2020 00:57
To: Winkler, Tomas <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Usyskin, Alexander <[email protected]>; linux- [email protected]; Gustavo A . R . Silva <[email protected]>
Subject: Re: [char-misc-next] Revert "mei: hdcp: Replace one-element array with flexible-array member"

Quoted 8 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

Quoted 50 lines

Thanks
--
Gustavo

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device

Quoted 19 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device

*dev,

Quoted 15 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-
 seq_num_m);
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in { · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in {
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#3 lore raw
Quoted 20 lines · Tomas
Quoted 12 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Wednesday, July 29, 2020 00:57
To: Winkler, Tomas <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Usyskin, Alexander <[email protected]>; linux- [email protected]; Gustavo A . R . Silva <[email protected]>
Subject: Re: [char-misc-next] Revert "mei: hdcp: Replace one-element array with flexible-array member"

Quoted 8 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

Quoted 9 lines

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.c
Arnd Bergmann <[email protected]> (supporter:CHAR and MISC DRIVERS)
Greg Kroah-Hartman <[email protected]> (supporter:CHAR and MISC DRIVERS)
[email protected] (open list)
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.h
Arnd Bergmann <[email protected]> (supporter:CHAR and MISC DRIVERS)
Greg Kroah-Hartman <[email protected]> (supporter:CHAR and MISC DRIVERS)
[email protected] (open list)

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and lists?

Thanks
--
Gustavo

Quoted 46 lines
Quoted 46 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device

Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device

*dev,

Quoted 15 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-
 seq_num_m);
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in { · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in {
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#4 lore raw
Quoted 56 lines · Gustavo A. R. Silva
Quoted 20 lines · Tomas
Quoted 12 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Wednesday, July 29, 2020 00:57
To: Winkler, Tomas <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Usyskin, Alexander <[email protected]>; linux- [email protected]; Gustavo A . R . Silva <[email protected]>
Subject: Re: [char-misc-next] Revert "mei: hdcp: Replace one-element array with flexible-array member"

Quoted 8 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

Quoted 9 lines

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.c
Arnd Bergmann <[email protected]> (supporter:CHAR and MISC DRIVERS)
Greg Kroah-Hartman <[email protected]> (supporter:CHAR and MISC DRIVERS)
[email protected] (open list)
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.h
Arnd Bergmann <[email protected]> (supporter:CHAR and MISC DRIVERS)
Greg Kroah-Hartman <[email protected]> (supporter:CHAR and MISC DRIVERS)
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and lists?>

Notice that if I run this command:

$ scripts/get_maintainer.pl -f drivers/misc/mei/hdcp/mei_hdcp.h
Arnd Bergmann <[email protected]> (supporter:CHAR and MISC DRIVERS)
Greg Kroah-Hartman <[email protected]> (supporter:CHAR and MISC DRIVERS)
Ramalingam C <[email protected]> (commit_signer:2/2=100%,authored:2/2=100%,added_lines:4/4=100%,removed_lines:13/13=100%)
Tomas Winkler <[email protected]> (commit_signer:2/2=100%)
Uma Shankar <[email protected]> (commit_signer:2/2=100%)
Jani Nikula <[email protected]> (commit_signer:2/2=100%)
Shashank Sharma <[email protected]> (commit_signer:2/2=100%)
[email protected] (open list)

You appear this time, but not as a maintainer.

Thanks
--
Gustavo

Quoted 46 lines
Quoted 46 lines
Quoted 46 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device

Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device

*dev,

Quoted 15 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-
 seq_num_m);
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in { · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in {
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#5 lore raw
In reply to Gustavo A. R. Silva
Quoted 70 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Wednesday, July 29, 2020 01:15
To: Winkler, Tomas <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Usyskin, Alexander <[email protected]>; linux- [email protected]; Gustavo A . R . Silva <[email protected]>
Subject: Re: [char-misc-next] Revert "mei: hdcp: Replace one-element array with flexible-array member"

Quoted 20 lines · Tomas
Quoted 12 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Wednesday, July 29, 2020 00:57
To: Winkler, Tomas <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Usyskin, Alexander <[email protected]>; linux- [email protected]; Gustavo A . R . Silva <[email protected]>
Subject: Re: [char-misc-next] Revert "mei: hdcp: Replace one-element array with flexible-array member"

Quoted 8 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

Quoted 9 lines

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl --nokeywords --
nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann
<[email protected]> (supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and lists?

Not sure, it should be caught by drivers/misc/mei/* ? Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 52 lines

Thanks
--
Gustavo

Quoted 21 lines
Quoted 21 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device

Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device · line 573

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
 
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#6 lore raw
Quoted 54 lines
Quoted 45 lines
Quoted 9 lines
Quoted 9 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

Quoted 9 lines

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl
--nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and

lists?

Not sure, it should be caught by drivers/misc/mei/* ?
Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

Quoted 10 lines
M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*

It's not recursive, when I add drivers/misc/mei/hdcp/* . It works correctly I will post a patch.

Thanks
Tomas

Quoted 55 lines
Quoted 35 lines

Thanks
--
Gustavo

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct
Quoted 1 line

device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct

wired_cmd_repeater_auth_stream_req_in

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#7 lore raw

Tomas,

Please, see some comments below...

Quoted 14 lines · Tomas
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I don't think the fix for this is to add 1 byte, if any, it seems to be sizeof(*data->streams), or sizeof(struct hdcp2_streamid_type) what needs to be added.

But it might be better to code something like this, instead:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index e6c3dc595617..7fe63c915548 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              (data->k * sizeof(*data->streams)));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;

struct_size(&verify_mprime_in, streams, data->k) will give us the size, in bytes, of struct wired_cmd_repeater_auth_stream_req_in plus the size in bytes for the streams[] flexible-array, which is determined by struct hdcp2_streamid_type and data->k.

What do you think?

See more comments below...

Quoted 47 lines
Quoted 36 lines
Quoted 27 lines

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl
--nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and

lists?

Not sure, it should be caught by drivers/misc/mei/* ?
Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

Quoted 10 lines
M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 3 lines

It's not recursive, when I add drivers/misc/mei/hdcp/* . It works correctly I will post a patch.

Great. I'm glad we got to the root cause of this issue. :)

Thanks
--
Gustavo

Quoted 59 lines

Thanks
Tomas

Quoted 55 lines
Quoted 35 lines

Thanks
--
Gustavo

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct
Quoted 1 line

device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct

wired_cmd_repeater_auth_stream_req_in

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#8 lore raw
Quoted 55 lines

Tomas,

Please, see some comments below...

Quoted 14 lines · Tomas
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I don't think the fix for this is to add 1 byte, if any, it seems to be sizeof(*data-

Quoted 1 line

streams), or sizeof(struct hdcp2_streamid_type) what needs to be added.

But it might be better to code something like this, instead:

drivers/misc/mei/hdcp/mei_hdcp.c +3 -2
index e6c3dc595617..7fe63c915548 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device
 *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-
 >seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              (data->k * sizeof(*data->streams)));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams,
+ data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;
Quoted 7 lines

struct_size(&verify_mprime_in, streams, data->k) will give us the size, in bytes, of struct wired_cmd_repeater_auth_stream_req_in plus the size in bytes for the streams[] flexible-array, which is determined by struct hdcp2_streamid_type and
data->k.

What do you think?

I think I will talk to the firmware guys tomorrow morning...

Quoted 121 lines

See more comments below...

Quoted 48 lines
Quoted 37 lines
Quoted 27 lines

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS)
linux- [email protected] (open list) $
scripts/get_maintainer.pl --nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS)
linux- [email protected] (open list)
Quoted 3 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and

lists?

Not sure, it should be caught by drivers/misc/mei/* ? Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

Quoted 10 lines
M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 3 lines

It's not recursive, when I add drivers/misc/mei/hdcp/* . It works correctly I will post a patch.

Great. I'm glad we got to the root cause of this issue. :)

Thanks
--
Gustavo

Quoted 52 lines

Thanks
Tomas

Quoted 48 lines
Quoted 35 lines

Thanks
--
Gustavo

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct
Quoted 1 line

device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct

wired_cmd_repeater_auth_stream_req_in

Quoted 4 lines

{

Quoted 3 lines
Quoted 3 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	m_prime[HDCP_2_2_MPRIME_LEN];
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#9 lore raw
In reply to Gustavo A. R. Silva
Quoted 50 lines · Gustavo A. R. Silva

Tomas,

Please, see some comments below...

Quoted 14 lines · Tomas
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Could you elaborate on what's the firmware expecting, exactly?

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I don't think the fix for this is to add 1 byte, if any, it seems to be sizeof(*data->streams), or sizeof(struct hdcp2_streamid_type) what needs to be added.

But it might be better to code something like this, instead:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index e6c3dc595617..7fe63c915548 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              (data->k * sizeof(*data->streams)));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;
Quoted 7 lines

struct_size(&verify_mprime_in, streams, data->k) will give us the size, in bytes, of struct wired_cmd_repeater_auth_stream_req_in plus the size in bytes for the streams[] flexible-array, which is determined by struct hdcp2_streamid_type and data->k.

What do you think?

This is even better:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index e6c3dc595617..852374565cba 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              flex_array_size(&verify_mprime_in, streams, data->k));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;

the flex_array_size() is a new helper that was designed for this situations. :) It calculates the size of a flexible array member within an enclosing structure, which is exactly the case.

Thanks
--
Gustavo

Quoted 118 lines

See more comments below...

Quoted 47 lines
Quoted 36 lines
Quoted 27 lines

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl
--nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and

lists?

Not sure, it should be caught by drivers/misc/mei/* ?
Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

Quoted 10 lines
M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 3 lines

It's not recursive, when I add drivers/misc/mei/hdcp/* . It works correctly I will post a patch.

Great. I'm glad we got to the root cause of this issue. :)

Thanks
--
Gustavo

Quoted 59 lines

Thanks
Tomas

Quoted 55 lines
Quoted 35 lines

Thanks
--
Gustavo

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct
Quoted 1 line

device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct

wired_cmd_repeater_auth_stream_req_in

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#10 lore raw
Quoted 9 lines · Gustavo A. R. Silva
Quoted 6 lines · Gustavo A. R. Silva

Tomas,

Please, see some comments below...

Quoted 1 line · Tomas
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi Tomas,

Quoted 3 lines · Tomas Winkler

Greg please revert, this commit it changes size of struct wired_cmd_repeater_auth_stream_req_in, this is not what firmware is expecting.

Instead of reverting that commit, I think this patch should be applied to fix it, if Tomas consider this is the appropiate solution:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index d1d3e025ca0e..852374565cba 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              array_size(data->k, sizeof(*data->streams)));
+              flex_array_size(&verify_mprime_in, streams, data->k));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;

I'll write up a proper patch after getting some feedback.

Thanks
--
Gustavo

Quoted 193 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

Could you elaborate on what's the firmware expecting, exactly?

struct wired_cmd_repeater_auth_stream_req_in {
- struct hdcp2_streamid_type streams[1];
+ struct hdcp2_streamid_type streams[];
}

But then you have, which you haven't changed to + 1 byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,

                              sizeof(verify_mprime_in));

I don't think the fix for this is to add 1 byte, if any, it seems to be sizeof(*data->streams), or sizeof(struct hdcp2_streamid_type) what needs to be added.

But it might be better to code something like this, instead:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index e6c3dc595617..7fe63c915548 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              (data->k * sizeof(*data->streams)));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;
Quoted 7 lines

struct_size(&verify_mprime_in, streams, data->k) will give us the size, in bytes, of struct wired_cmd_repeater_auth_stream_req_in plus the size in bytes for the streams[] flexible-array, which is determined by struct hdcp2_streamid_type and data->k.

What do you think?

This is even better:

drivers/misc/mei/hdcp/mei_hdcp.c +2 -2
index e6c3dc595617..852374565cba 100644
@@ -572,12 +572,12 @@ static int mei_hdcp_verify_mprime(struct device *dev,
               HDCP_2_2_MPRIME_LEN);
        drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
        memcpy(verify_mprime_in.streams, data->streams,
-              (data->k * sizeof(struct hdcp2_streamid_type)));
+              flex_array_size(&verify_mprime_in, streams, data->k));
 
        verify_mprime_in.k = cpu_to_be16(data->k);
 
        byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+                             struct_size(&verify_mprime_in, streams, data->k));
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;

the flex_array_size() is a new helper that was designed for this situations. :) It calculates the size of a flexible array member within an enclosing structure, which is exactly the case.

Thanks
--
Gustavo

Quoted 118 lines

See more comments below...

Quoted 47 lines
Quoted 36 lines
Quoted 27 lines

I see, this is the kind of feedback I need from people that knows the code better. Thanks!

Quoted 4 lines

But that's not the major point. Point is that we should be able to review and test the code before it is merged. You haven't run it, right? There is MAINTAINERS file for a reason.

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl
--nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
Quoted 2 lines

For some reason you don't appear on the list above. Do you see anything wrong with the command I'm running to get the maintainers and

lists?

Not sure, it should be caught by drivers/misc/mei/* ?
Maybe it is not recursive? Need to check the script, frankly I usually check this manually.

INTEL MANAGEMENT ENGINE (mei)

Quoted 10 lines
M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 3 lines

It's not recursive, when I add drivers/misc/mei/hdcp/* . It works correctly I will post a patch.

Great. I'm glad we got to the root cause of this issue. :)

Thanks
--
Gustavo

Quoted 59 lines

Thanks
Tomas

Quoted 55 lines
Quoted 35 lines

Thanks
--
Gustavo

Quoted 22 lines
Quoted 22 lines
Quoted 20 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct
Quoted 1 line

device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct

wired_cmd_repeater_auth_stream_req_in

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#11 lore raw
In reply to Winkler, Tomas
Quoted 2 lines · Tomas
Quoted 2 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>

[]

Quoted 18 lines
Quoted 6 lines

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

Quoted 11 lines
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list) $ scripts/get_maintainer.pl --nokeywords --
nogit --nogit-fallback drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann
<[email protected]> (supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS) linux-
[email protected] (open list)
For some reason you don't appear on the list above. Do you see anything
wrong with the command I'm running to get the maintainers and lists?
Quoted 1 line

Not sure, it should be caught by drivers/misc/mei/* ?

No, this pattern matches _only_ files in that
particular directory and not any files in any
subdirectory.

Quoted 1 line

Maybe it is not recursive?

It depends on the pattern.
Patterns with trailing slashes match subdirectories too.

from MAINTAINERS:

F: *Files* and directories wildcard patterns.
A trailing slash includes all files and subdirectory files.
F: drivers/net/ all files in and below drivers/net
F: drivers/net/* all files in drivers/net, but not below
F: */net/* all files in "any top level directory"/net
One pattern per line. Multiple F: lines acceptable.

Quoted 9 lines

Need to check the script,
frankly I usually check this manually. prob

INTEL MANAGEMENT ENGINE (mei)

M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*

You probably want:

F: drivers/misc/mei/

Quoted 56 lines
F:      drivers/watchdog/mei_wdt.c
F:      include/linux/mei_cl_bus.h
F:      include/uapi/linux/mei.h
F:      samples/mei/*
Quoted 50 lines

Thanks
--
Gustavo

Quoted 20 lines
Quoted 20 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device

Quoted 19 lines

I really do not appreciate that the code is bypassing driver maintaner review, I think this is a minimum we can ask for, this is not for a first time.

This reverts commit c56967d674e361ebe716e66992e3c5332b25ac1f.

Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 2 +-
drivers/misc/mei/hdcp/mei_hdcp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
index d1d3e025ca0e..e6c3dc595617 100644
@@ -572,7 +572,7 @@ static int mei_hdcp_verify_mprime(struct device

*dev,

Quoted 2 lines
Quoted 2 lines

drivers/misc/mei/hdcp/mei_hdcp.c static int mei_hdcp_verify_mprime(struct device · line 573

Quoted 2 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	       HDCP_2_2_MPRIME_LEN);
 	drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data-

seq_num_m);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/misc/mei/hdcp/mei_hdcp.c +1 -1
 	memcpy(verify_mprime_in.streams, data->streams,
-	       array_size(data->k, sizeof(*data->streams)));
+	       (data->k * sizeof(struct hdcp2_streamid_type)));
 
Quoted 8 lines
Quoted 8 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in

Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.c +0 -0
 	verify_mprime_in.k = cpu_to_be16(data->k);
 
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
index 834757f5e072..18ffc773fa18 100644
@@ -358,7 +358,7 @@ struct wired_cmd_repeater_auth_stream_req_in

{

Quoted 10 lines
Quoted 10 lines

drivers/misc/mei/hdcp/mei_hdcp.h struct wired_cmd_repeater_auth_stream_req_in · line 358

Quoted 1 line
drivers/misc/mei/hdcp/mei_hdcp.h +0 -0
 	u8
	seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
Quoted 8 lines
drivers/misc/mei/hdcp/mei_hdcp.h +1 -1
 	u8				m_prime[HDCP_2_2_MPRIME_LEN];
 	__be16				k;
-	struct hdcp2_streamid_type	streams[];
+	struct hdcp2_streamid_type	streams[1];
 } __packed;
 
 struct wired_cmd_repeater_auth_stream_req_out {
#12 lore raw
Quoted 53 lines · Tomas
Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>

[]

Quoted 6 lines
Quoted 6 lines

I'm using this command:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback

and this is the output for both files:

Quoted 11 lines
Quoted 11 lines
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.c Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS)
linux- [email protected] (open list) $
scripts/get_maintainer.pl --nokeywords -- nogit --nogit-fallback
drivers/misc/mei/hdcp/mei_hdcp.h Arnd Bergmann <[email protected]>
(supporter:CHAR and MISC DRIVERS) Greg Kroah-Hartman
<[email protected]> (supporter:CHAR and MISC DRIVERS)
linux- [email protected] (open list) For some reason you don't
appear on the list above. Do you see anything wrong with the command

I'm running to get the maintainers and lists?

Quoted 2 lines

Not sure, it should be caught by drivers/misc/mei/* ?

No, this pattern matches _only_ files in that particular directory and not any files in any subdirectory.

Quoted 1 line

Maybe it is not recursive?

It depends on the pattern.
Patterns with trailing slashes match subdirectories too.

from MAINTAINERS:

F: *Files* and directories wildcard patterns.
A trailing slash includes all files and subdirectory files.
F: drivers/net/ all files in and below drivers/net
F: drivers/net/* all files in drivers/net, but not below
F: */net/* all files in "any top level directory"/net
One pattern per line. Multiple F: lines acceptable.

Quoted 9 lines

Need to check the script,
frankly I usually check this manually. prob

INTEL MANAGEMENT ENGINE (mei)

M:      Tomas Winkler <[email protected]>
L:      [email protected]
S:      Supported
F:      Documentation/driver-api/mei/*
F:      drivers/misc/mei/*
Quoted 3 lines

You probably want:

F: drivers/misc/mei/

Yes, thanks.
Tomas