Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2288513pxb; Fri, 8 Oct 2021 05:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDWAuAs/Xe20HVFYoZg0ywCOvKDsubBY10A640HAv+f9NqW7g7I6ZOoVRmsfGu9TPomzpc X-Received: by 2002:a05:6402:2808:: with SMTP id h8mr7988539ede.394.1633694559090; Fri, 08 Oct 2021 05:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633694559; cv=none; d=google.com; s=arc-20160816; b=G5hYftaGduqXqWaxUIomkx1PWxTiODeOyVX0BtmCG0rpJmlHm2/iwKgu0Mz9dE/uSD lBINlAPxcwQinCUNk/oChg7o4m9EmUap/O+U/hD3VzTNWWxK2R8cCAkG91bRKKSLFWda 5ubjF5KFPNz/vyW3lFT0jym8B5XktDvc2VEmd5TTZf9zf5VJB4IFBO2Rdy5iw39CiS37 vD2U1HzxjedSGuQwt5Ctw2D4V8JIrenrO48rH0csk7E/l5V6mXPmoVyVhellGjADnyxh cdfO/uDfBwpqIFXWnEm3epo+be/6igSJ22/0fm4+oVypQmCf36B7wThP9LszLmLcOzTU nezg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=SC8hReYQvIcHPyAxZmLj0MQ5cORe7/CwBL5w1K7l6/U=; b=vb7sAsZaQEJwUys6ulW7WY4fJrQ+v/X6eEQZ5Re/gUsa9fLM1gvEMzhc1ZjsLTaNPV 9FaTRUsGGg6EvtnFZNGY3nMouwhZ7MwltABohScNhEfBv8iToatHT1ujZ9LGiB55RgIw X/prIW9k5K/GPRyfps6ikBKrFpxsVp1RpH/Adrrc5lWnaDyE7AXPTHsL2+aOl2L3IDUI k95q+7WssUC7wewFaB4BRDfgBWAU4wmC3mupPcit55DhQty9d7RPcIUMHAypG6mPYXap r77FJ3J/ZIM444937Qn8X2/8vVVU8XbmZ89vQBlwSj1XrB07XDuzcQCAlSFlwsRWRseO BnOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si3158284ejg.395.2021.10.08.05.02.11; Fri, 08 Oct 2021 05:02:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240571AbhJHL7y (ORCPT + 99 others); Fri, 8 Oct 2021 07:59:54 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3949 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbhJHL7y (ORCPT ); Fri, 8 Oct 2021 07:59:54 -0400 Received: from fraeml745-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4HQmnS37cSz6H6jV; Fri, 8 Oct 2021 19:54:20 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml745-chm.china.huawei.com (10.206.15.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 8 Oct 2021 13:57:56 +0200 Received: from [10.47.80.141] (10.47.80.141) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Fri, 8 Oct 2021 12:57:55 +0100 Subject: Re: [PATCH v3] scsi: core: Fix shost->cmd_per_lun calculation in scsi_add_host_with_dma() To: Dexuan Cui , , , , , , , , , , , , CC: , References: <20211008043546.6006-1-decui@microsoft.com> From: John Garry Message-ID: <8c87879b-ad28-e7bd-71ec-0c8a2ee99e7c@huawei.com> Date: Fri, 8 Oct 2021 13:00:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20211008043546.6006-1-decui@microsoft.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.80.141] X-ClientProxiedBy: lhreml744-chm.china.huawei.com (10.201.108.194) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/10/2021 05:35, Dexuan Cui wrote: > After commit ea2f0f77538c, a 416-CPU VM running on Hyper-V hangs during > boot because the hv_storvsc driver sets scsi_driver.can_queue to an "int" > value that exceeds SHRT_MAX, and hence scsi_add_host_with_dma() sets > shost->cmd_per_lun to a negative "short" value. > > Use min_t(int, ...) to fix the issue. > > Fixes: ea2f0f77538c ("scsi: core: Cap scsi_host cmd_per_lun at can_queue") > Cc:stable@vger.kernel.org > Signed-off-by: Dexuan Cui > Reviewed-by: Haiyang Zhang > Reviewed-by: Ming Lei Reviewed-by: John Garry thanks