Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp2089464ybm; Sun, 31 May 2020 08:14:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxt1V+YBpFIpL6yGqBiYHwWWxN3aRjIbhB5UWqayaglL3WxSVpNwIYepToi/m0XP+hVvbT X-Received: by 2002:a05:6402:16d6:: with SMTP id r22mr16890311edx.289.1590938089612; Sun, 31 May 2020 08:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590938089; cv=none; d=google.com; s=arc-20160816; b=IYr0nVmcftXyOlIG/vFD7/z8Bc8gaBm/8VHo/kDGZNXon/8E6kOPI+SwfRQPGG16gi HZBlBvLiVlOICD0ggvyDemTKkgtdV+CAhtNbA7YIG85n17XhSM/AwvqIx5ENVEn7H82B ex7mMCGoLbsu6WLsy5u7yE5TAbGJNEWE82P9GAiXXOzzng1mTm442D/UDHMPJ2pqwcmH yJJtASAf9BlBtO/sDGoFPDRfv0vLP54QwE4pC64e1/K4B/TpigY1g23eBz/leFBLzyTX pFPdjFwuLgtWQshev6RkDvPtsb8A+WYX0mDifRLkNk9sAueeMGAHVifDrOyBkIZMc7uj vqpQ== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=qmyo/X6VyM6B0p3Oyzj8ZuaBZb1ZMqKAyygqVhv3TYY=; b=qvyVbMpQlyeV5fasK5FTCC19Y5n7ao9rmYW9sCwI1J2ejE/yktUSUCeGCwISubcrdL TP5Q0KGxC2RDi40FPMcHSgjb5kYzVIKliIWYSl1FWiZtnFWF4K+KLB1GgWuPpYplERXS TkmRUfj8rIFWvR6KN0u/cyNLP2w+M2gucjJhy9yAZRsGBuotKRXTh+CzsGDerGCi7WzV K6YB0518GpSrcOXPZ7+kqCS7aKzg8TI1RNjcpjHFadGmnojjlhnvg7/wlxt/00+vJiPS aD2C3yJ8a9dlXG4cdp+e/cn1vgudO6/t58MArHQtMfv079u4yGhyoC1GRb3C2U9fryie CreQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cn4FkR6n; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id re27si3225947ejb.426.2020.05.31.08.14.25; Sun, 31 May 2020 08:14:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cn4FkR6n; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728200AbgEaPLv (ORCPT + 99 others); Sun, 31 May 2020 11:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbgEaPLu (ORCPT ); Sun, 31 May 2020 11:11:50 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74DB9C061A0E; Sun, 31 May 2020 08:11:50 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id z5so6830901ejb.3; Sun, 31 May 2020 08:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=qmyo/X6VyM6B0p3Oyzj8ZuaBZb1ZMqKAyygqVhv3TYY=; b=Cn4FkR6nLqCH9bdug4xsWLWFjLEptyie0SPoXp7+xXPEJgay48RckfPgTjZ5yAUhhp RLyjDGOkRikWF12WN9s4s+W4etR7qSL/e1h24sf9wVF83utnKlDBclkVbn7NIxX+0lsW EiiZkmrdF4pU+ScVAioEv5WXgiJee8/VabRULZu/R41CUCQvm0k2qdBc4fskfl8JQpkr 1E/znehBjKdhwMJTHnVTBMOrXQGKuc5+jfXPM0NLTCAuLhNEf2d/M6ekpyUvYuNh1Ah4 sKxMRYXw/slKGtDgzvCtJOI5gteUVY/q2rPmXQ01wGJZnn8gc36aUGuexOczdlyDNyYK whKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=qmyo/X6VyM6B0p3Oyzj8ZuaBZb1ZMqKAyygqVhv3TYY=; b=SPWb+viiph+gP/5+2zNzGebKf4WI1D2m4S1uXKye3QW3zSzBe7m+EvlHmndWvDwlRR Bz2acTYyGhV12hrsUWyLUQOralRw4Cr3jGUnYaSp4F0hJ8OKJ+vu0XMFrBrFpEYxDAhW Ric1KPXb7v9RYWiufIMQB0PrSLlTUFkLtyfBu3FU8lo+2myfwhM44YBpqhD2LgRFAY36 08ppM2wljV7zTkFEgHG08OnKvo6C+43TK1KRdTPtTDCXcbi6H7UBhQPeruK/t4yH5QIL ZSpelXpYBmSEbPonS/IOyJQPKop3Vxh1WhxrqbpMWuZb+Bd2Ynjb+swYMbtsGrjRYor9 +6vw== X-Gm-Message-State: AOAM531n3dlbpSGxKXIBjo7iasn2LdjIBRwHNgjLjMJ3+1jb6pHdQVIC wJ4m4Xaju0pCf9Af37ec9MQ= X-Received: by 2002:a17:906:a44:: with SMTP id x4mr5929322ejf.237.1590937909059; Sun, 31 May 2020 08:11:49 -0700 (PDT) Received: from ubuntu-laptop (ip5f5bfcfd.dynamic.kabel-deutschland.de. [95.91.252.253]) by smtp.googlemail.com with ESMTPSA id ld9sm12580892ejb.30.2020.05.31.08.11.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 May 2020 08:11:48 -0700 (PDT) Message-ID: <3329e7ed6714cd86ec91cca96e5980da1df11f11.camel@gmail.com> Subject: Re: [PATCH v4 3/4] scsi: ufs: cleanup ufs initialization path From: Bean Huo To: Avri Altman , "alim.akhtar@samsung.com" , "asutoshd@codeaurora.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "stanley.chu@mediatek.com" , "beanhuo@micron.com" , "bvanassche@acm.org" , "tomas.winkler@intel.com" , "cang@codeaurora.org" Cc: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Sun, 31 May 2020 17:11:46 +0200 In-Reply-To: References: <20200529164054.27552-1-huobean@gmail.com> <20200529164054.27552-4-huobean@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2020-05-30 at 06:37 +0000, Avri Altman wrote: > > + /* Get the length of descriptor */ > > + ufshcd_map_desc_id_to_length(hba, desc_id, &buff_len); > > + if (!buff_len) { > > + dev_err(hba->dev, "%s: Failed to get desc length", > > __func__); > > + return -EINVAL; > > } > > > > /* Check whether we need temp memory */ > > The first time we are reading the descriptor, we no longer can rely > on its true size. > So for this check, buff_len is 256 and kmalloc will always happen. > Do you think that this check is still relevant? > > /* Check whether we need temp memory */ > if (param_offset != 0 || param_size < buff_len) { > desc_buf = kmalloc(buff_len, GFP_KERNEL); > if (!desc_buf) > return -ENOMEM; > } else { > desc_buf = param_read_buf; > is_kmalloc = false; > } Avri I found this checkup is still needed since LU descriptor read will multiple enter this function. so I didn't delete it in the new version patch. thanks, Bean