On 06/25/2015, 03:44 PM, Brian King wrote:
> Fixes another signed / unsigned array indexing bug in the ipr driver.

Could you be more specific? Specifically, I fail to see why you do +1
twice now.

> --- linux/drivers/scsi/ipr.c~ipr_hrrq_index_fix       2015-06-23 
> 11:43:18.151741523 -0500
> +++ linux-bjking1/drivers/scsi/ipr.c  2015-06-23 11:43:18.157741435 -0500
> @@ -1052,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct
>  
>  static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg)
>  {
> +     unsigned int hrrq;
> +
>       if (ioa_cfg->hrrq_num == 1)
> -             return 0;
> -     else
> -             return (atomic_add_return(1, &ioa_cfg->hrrq_index) % 
> (ioa_cfg->hrrq_num - 1)) + 1;
> +             hrrq = 0;
> +     else {
> +             hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index);
> +             hrrq = ((hrrq + 1) % (ioa_cfg->hrrq_num - 1)) + 1;
> +     }
> +     return hrrq;

thanks,
-- 
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to