Re: [PATCH 1/3] media: mceusb: filter out bogus timing irdata of duration 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sean,

On Fri, May 11, 2018 at 09:36:48AM +0100, Sean Young wrote:
> A mceusb device has been observed producing invalid irdata. Proactively
> guard against this.

Thanks a lot, the patch series looks good to me! Good catch on the
missing break BTW.

We've included this patch in LibreELEC testbuilds, so far we got
not complaints.

so long,

Hias

> 
> Suggested-by: Matthias Reichl <hias@xxxxxxxxx>
> Signed-off-by: Sean Young <sean@xxxxxxxx>
> ---
>  drivers/media/rc/mceusb.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
> index 1619b748469b..1ca49491abc8 100644
> --- a/drivers/media/rc/mceusb.c
> +++ b/drivers/media/rc/mceusb.c
> @@ -1177,6 +1177,11 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
>  			init_ir_raw_event(&rawir);
>  			rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0);
>  			rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK);
> +			if (unlikely(!rawir.duration)) {
> +				dev_warn(ir->dev, "nonsensical irdata %02x with duration 0",
> +					 ir->buf_in[i]);
> +				break;
> +			}
>  			if (rawir.pulse) {
>  				ir->pulse_tunit += rawir.duration;
>  				ir->pulse_count++;
> -- 
> 2.14.3
> 



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux