Checking the range of the parameter speed, avoid integer overflow. Signed-off-by: JiangJianJun <jiangjianjun3@xxxxxxxxxx> --- drivers/scsi/sr_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 5b0b35e60e61..d5b2cd80d171 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -430,6 +430,8 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed) Scsi_CD *cd = cdi->handle; struct packet_command cgc; + if (speed < 0 || speed > (INT_MAX / 177)) + return -EINVAL; if (speed == 0) speed = 0xffff; /* set to max */ else -- 2.39.3