Skip to content

Commit cf12086

Browse files
committed
copier: require a full word for the attenuation control
The attenuation setter only rejected oversized payloads, then dereferenced the data as a 32-bit value; a payload shorter than that read past the mailbox. Require exactly a 32-bit payload. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 957cc9f commit cf12086

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/audio/copier/copier.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,9 +795,11 @@ __cold static int set_attenuation(struct comp_dev *dev, uint32_t data_offset, co
795795

796796
assert_can_be_cold();
797797

798-
/* only support attenuation in format of 32bit */
799-
if (data_offset > sizeof(uint32_t)) {
800-
comp_err(dev, "attenuation data size %d is incorrect", data_offset);
798+
/* only support attenuation in format of 32bit; the payload is
799+
* dereferenced as a uint32_t below so it must be exactly that size
800+
*/
801+
if (data_offset != sizeof(uint32_t)) {
802+
comp_err(dev, "attenuation data size %u is incorrect", data_offset);
801803
return -EINVAL;
802804
}
803805

0 commit comments

Comments
 (0)