Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: uapi/linux/cec.h: cec_msg_set_reply_to: zero flags

The cec_msg_set_reply_to() helper function never zeroed the
struct cec_msg flags field, this can cause unexpected behavior
if flags was uninitialized to begin with.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: 0dbacebede1e ("[media] cec: move the CEC framework out of staging and to media")
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
599f6899 e7311aa4

+5 -1
+5 -1
include/uapi/linux/cec.h
··· 132 132 * Set the msg destination to the orig initiator and the msg initiator to the 133 133 * orig destination. Note that msg and orig may be the same pointer, in which 134 134 * case the change is done in place. 135 + * 136 + * It also zeroes the reply, timeout and flags fields. 135 137 */ 136 138 static inline void cec_msg_set_reply_to(struct cec_msg *msg, 137 139 struct cec_msg *orig) ··· 141 139 /* The destination becomes the initiator and vice versa */ 142 140 msg->msg[0] = (cec_msg_destination(orig) << 4) | 143 141 cec_msg_initiator(orig); 144 - msg->reply = msg->timeout = 0; 142 + msg->reply = 0; 143 + msg->timeout = 0; 144 + msg->flags = 0; 145 145 } 146 146 147 147 /**