> From: John Garry <john.garry@xxxxxxxxxx> > Sent: Wednesday, October 6, 2021 9:03 AM > >> ... > >>> + if (scsi_driver.can_queue > SHRT_MAX) > >>> + scsi_driver.can_queue = SHRT_MAX; > >>> + > > > > This fix works, but is a more of a temporary hack until I can finish > > a larger overhaul of the algorithm. > > > But for now, I think the better > > fix is for ea2f0f77538c to do the comparison as "int" instead of "short". > > > > That seems better to me. But Let's wait for other possible opinion. > > Thanks, > John It looks like shost->cmd_per_lun has been "short" since day 1. I don't know whether it should be changed to unsigned int. Thanks for the thoughts! I'll post a v2 like the below in 24 hours. diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 3f6f14f0cafb..24b72ee4246f 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -220,7 +220,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } - shost->cmd_per_lun = min_t(short, shost->cmd_per_lun, + /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ + shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, shost->can_queue); error = scsi_init_sense_cache(shost)