summaryrefslogtreecommitdiff
path: root/drivers/misc/mei/hdcp/mei_hdcp.h
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2020-07-22 13:15:34 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-23 09:27:09 +0200
commitc56967d674e361ebe716e66992e3c5332b25ac1f (patch)
tree17022f48fd2f057224aef96402f83645ddd5e438 /drivers/misc/mei/hdcp/mei_hdcp.h
parentcb0cec23cec009dd4a7c9a9f1ba9177b6047324e (diff)
downloadlwn-c56967d674e361ebe716e66992e3c5332b25ac1f.tar.gz
lwn-c56967d674e361ebe716e66992e3c5332b25ac1f.zip
mei: hdcp: Replace one-element array with flexible-array member
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Also, make use of the array_size() helper instead of the open-coded version in memcpy(). These sorts of multiplication factors need to be wrapped in array_size(). And while there, use the preferred form for passing a size of a struct. The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed as argument is not. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/79 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200722181534.GA31357@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hdcp/mei_hdcp.h')
-rw-r--r--drivers/misc/mei/hdcp/mei_hdcp.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/mei/hdcp/mei_hdcp.h b/drivers/misc/mei/hdcp/mei_hdcp.h
index 18ffc773fa18..834757f5e072 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.h
+++ b/drivers/misc/mei/hdcp/mei_hdcp.h
@@ -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[1];
+ struct hdcp2_streamid_type streams[];
} __packed;
struct wired_cmd_repeater_auth_stream_req_out {