Re: [PATCH] media: dvb-usb-v2: gl861: Fix null-ptr-deref in gl861_i2c_master_xfer

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

 



Is the first chunk of your patch really necessary?
`msg[0].len < 2` includes the `msg[0].len == 0` case,
so the `msg.buf == NULL && msg.len == 0` case is (seemed to me)
safely ejected as it is.

> --- a/drivers/media/usb/dvb-usb-v2/gl861.c
> +++ b/drivers/media/usb/dvb-usb-v2/gl861.c
> @@ -97,7 +97,7 @@ static int gl861_i2c_master_xfer(struct i2c_adapt
> 
> er *adap, struct i2c_msg msg[],
>  	/* XXX: I2C adapter maximum data lengths are not tested */
>  	if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
>  		/* I2C write */
> -		if (msg[0].len < 2 || msg[0].len > sizeof(ctx->buf)) {
> +		if (msg[0].len == 0 || msg[0].len > sizeof(ctx->buf)) {
>  			ret = -EOPNOTSUPP;
>  			goto err;
>  		}

regards,
akihiro





[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