Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp557304ybm; Thu, 28 May 2020 09:20:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwldQ6AWIl2JhXA1LuHw4W8PXS1eb0iPqRkkPHAHcV6ExoZv4GYGqDaZlu4crnzau19b6r X-Received: by 2002:a17:906:49ca:: with SMTP id w10mr3893496ejv.31.1590682853847; Thu, 28 May 2020 09:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590682853; cv=none; d=google.com; s=arc-20160816; b=MLP3gkzagcfF/0QMdQGEjQycFE3p1dUh7OsAJzIdAPrnTihaUi95Pn2WffxNMxGBZT 91mCH0exMk2zFRVoBFYbesUIZGhbYrqozewT59COGCtJtcvqoNByKo8Cfrpx8eqIkEK/ 7fHX/xkRoO6xVh+EBas5LYXP94Vg+44ljiSQjgISN7bTKS//3GPe1jUg/bYOEE88vRUp LeP9KPLRJT3f1u/46JnXKS2lpufzo9AxO/98LeGAPt88L901GSfdA56OYkDMyecbvbkP PjIDKN0enyNIRjwBzdOD3Etx54N5QPfqusyWyIx8pdbV0lHZB058xtRTt8dW64ReXjIy 2r3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=AiyBV0vGcERCP8qoB3YDvmHJfZC1K97O59wS9c3H20E=; b=eQyf+HoKqH3F/yoHMa2XvO50nUwrf6rD9kovuXDUL6OFozFwNy6TRgngzfc+yvfTgW 5Ml4Ap7YEXuo0eLD3AyRG+xVcfzxqsPVI8jMB5Y4TWptea6g9DNL4egzB/np8mWrsJqb vdJ2hwJ9PBxIq+TVZj3TyKmfBLfHHIF4s7GrKDwr7F5tJZ+VWzAPsvBWjUXU0fhe6s5+ GqsrYZrT7cYKpNFM1HMr2z62vv3eP89PWLOlcPe7x+6cuSXtgpc5hpq0DgteSIm9nw2S hyEYUBdK2MEo+zz1OGC2e7HrSlWBRvC4kqetCy6n0hnQW+iPKSEK6/4QyKipzTvQO6gx Ug8Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si693887edy.318.2020.05.28.09.20.30; Thu, 28 May 2020 09:20:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404950AbgE1QQI (ORCPT + 99 others); Thu, 28 May 2020 12:16:08 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40583 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404872AbgE1QQF (ORCPT ); Thu, 28 May 2020 12:16:05 -0400 Received: by mail-pg1-f194.google.com with SMTP id j21so13667238pgb.7; Thu, 28 May 2020 09:16:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=AiyBV0vGcERCP8qoB3YDvmHJfZC1K97O59wS9c3H20E=; b=ABLiMPA0aB9SPugVCCN6+iX9qDj8YVsAf115Rh/PgyjfHnJ8YFQMZ9wOi5qQGVadVv 6RI0mhcaeQGP0vgZM5X9gVm+t7Kg7//YlENJM2tDtuGj+XzuCwuLtfCvw68NVk8EwjYG enh1VD9yjnTb7/EfuLA6yz5J8AKklTq0G1loiWKOM7AGSfNetcUBawVBofqdGxVi0gg4 YeFjU0ArFCj7+4Xb5kJwT/39yjbr+i7KXtIOeK8a0jYg+pkGgu8VY6vdiOTBwZHubwc5 7PowMhrU8aJu6PKprUA0oWv+RLeQjFLj6naq6RbY2ePwHb+4EplNsn1F04G3NHxrH8/Q Wc3g== X-Gm-Message-State: AOAM530kP87+jfXaWB6A+pIL/GmDLM8EUCxiCnFFhsRDJdEE0rKSlnQ4 YUY/8O7yf7sKXVg9si57j7giPRXDUJs= X-Received: by 2002:a63:ef03:: with SMTP id u3mr3675843pgh.254.1590682564091; Thu, 28 May 2020 09:16:04 -0700 (PDT) Received: from ?IPv6:2601:647:4000:d7:40e6:aa88:9c03:e0b4? ([2601:647:4000:d7:40e6:aa88:9c03:e0b4]) by smtp.gmail.com with ESMTPSA id a85sm5013772pfd.181.2020.05.28.09.16.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 09:16:03 -0700 (PDT) Subject: Re: [PATCH v2 1/3] scsi: ufs: remove max_t in ufs_get_device_desc To: Bean Huo , alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200528115616.9949-1-huobean@gmail.com> <20200528115616.9949-2-huobean@gmail.com> <85bbc91f-7b91-46fc-acff-3bcc2288c4ae@acm.org> <82e8faa7d6a0c5f04832519740230f9f520347cb.camel@gmail.com> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H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IACQUCVI67igIbDAAK CRBxXD01xc4QCZ4dB/0QrnEasxjM0PGeXK5hcZMT9Eo998alUfn5XU0RQDYdwp6/kMEXMdmT oH0F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <8e1bfd09-0269-ecd6-eb24-31f953573189@acm.org> Date: Thu, 28 May 2020 09:16:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <82e8faa7d6a0c5f04832519740230f9f520347cb.camel@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-28 08:04, Bean Huo wrote: > do you mean like this: buff_len = hba->desc_size[id]? How about the following untested change? Thanks, Bart. diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 698e8d20b4ba..e33754c15c2c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6606,14 +6606,11 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba static int ufs_get_device_desc(struct ufs_hba *hba) { int err; - size_t buff_len; u8 model_index; u8 *desc_buf; struct ufs_dev_info *dev_info = &hba->dev_info; - buff_len = max_t(size_t, hba->desc_size.dev_desc, - QUERY_DESC_MAX_SIZE + 1); - desc_buf = kmalloc(buff_len, GFP_KERNEL); + desc_buf = kmalloc(QUERY_DESC_MAX_SIZE, GFP_KERNEL); if (!desc_buf) { err = -ENOMEM; goto out;