Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp762886pxj; Thu, 3 Jun 2021 19:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwTZtVAfW8ijmIgpe5N6JhdrXmh7Xi8mhIesaD0M1dNhGWrIgRxb3OqjnhPOUKfPeggPaA X-Received: by 2002:a50:cb85:: with SMTP id k5mr2426632edi.170.1622775412264; Thu, 03 Jun 2021 19:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622775412; cv=none; d=google.com; s=arc-20160816; b=S2N/xYVTBweiiUc+uCHhJkQkfLNg23JIWwRtJ6dMfOtRJcdW/cXsWUM1y80snLZB69 Ag0ZWsapWqrF8NiA7zxQ4gVciVu8Ryp24dM5njery3bmHcZxHUKnKE3id9Xs6nHWMZPQ 1df5I8qPn2Uqh9Ziff3btpEjxKp1V/QqCT2u8GK9Ur1vtEBE2vTY41DLyYka4c9BouKN nLXiV/uUvTZ2KOEbX2mmYDe6gBmuAh8pXfoFklV1bcaB4dtxCq/A3CilLTGPGW62CWDB DfRvizDja01ITaIFmMUy/l6ay59d+L0BwjItbSNnv2MvJ4BbgEBp5w8n/TAOPvNMhe8J C73A== 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=lfarpHwfp7BSQa/GuG0n45sx11I+xDYjLeTC1R+2hdY=; b=kddAxxdNLDcknZgVuo+idXues0COw9EfU1ghdzEpYyKo4z51ypmVzbT5zCsOeMNTpH yIKFjTPIbozUeR0MVrFg7HTDqPrvnuEuRzbcW6+ptgGihgOOc3J8KCeWAK34pK7eBKpC AM8bzWHZWqG43X0+VHC5iZrGjJHF/zOtqzQUXNeEidMtTZcdGlODY1HJnoR1MTuqdIaF 9Gl0ftyo53P/sTn22eyC6s/d5+lgmkuwpb9vu29iwO7VyS/ifOKjyKOx0DHRUhoTn9q5 bv0cg3aozvgVCet/l/NAeDEH94prcDQT955/laBbiXGgJayK2xRpJnJqfedUCrEibWh8 sUmA== 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 d14si3722863edp.279.2021.06.03.19.56.27; Thu, 03 Jun 2021 19:56:52 -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 S229761AbhFDC4R (ORCPT + 99 others); Thu, 3 Jun 2021 22:56:17 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:41752 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFDC4R (ORCPT ); Thu, 3 Jun 2021 22:56:17 -0400 Received: by mail-pl1-f173.google.com with SMTP id o12so532600plk.8; Thu, 03 Jun 2021 19:54:17 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lfarpHwfp7BSQa/GuG0n45sx11I+xDYjLeTC1R+2hdY=; b=h6287yTu9DfgNt8W5XbTY5qArOJDz67YqZqRPMwAUnDHeA0sXfld82P/8SBJCQy7VL fJoi+oRfDPT05pYCSC4HjfP4utSeIheMhsps78P5OSdvh8pWUxgEHE283GmDo0IC7gtR 7q49ndCBDautlhp+5rtB4wrCOMzRZrE/pv96Vk+hvO8z9layIGHTNEfRfiItz6Y4NkF9 Uhp9k4M/sNAUz7hy0tUyXsiqmKS2l1/zAh3TGwF3FzSFrEQRPzUyisu6WQYhITzOhJZc UwPq0LRVXriSuVgdV/6sB9pKh8QWj7wTRJqIlFXxYuU6hHACVS8K0N+EMEX1QMMxV7sF x42Q== X-Gm-Message-State: AOAM530KI0lA72ZZc0sv8OO7GVyfTfb/UJAWlJ+gQTf4HFvR+hi2pZgi ldLf4RBuZekx4iqd2sUtqfk= X-Received: by 2002:a17:90a:16c2:: with SMTP id y2mr2457951pje.236.1622775257215; Thu, 03 Jun 2021 19:54:17 -0700 (PDT) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id s22sm365790pfd.94.2021.06.03.19.54.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 19:54:16 -0700 (PDT) Subject: Re: [PATCH v35 3/4] scsi: ufs: Prepare HPB read for cached sub-region To: daejun7.park@samsung.com, Greg KH , "avri.altman@wdc.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "asutoshd@codeaurora.org" , "stanley.chu@mediatek.com" , "cang@codeaurora.org" , "huobean@gmail.com" , ALIM AKHTAR Cc: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , JinHwan Park , Javier Gonzalez , Sung-Jun Park , Jinyoung CHOI , Dukhyun Kwon , Keoseong Park , Jaemyung Lee , Jieon Seol References: <12392bef-e018-8260-5279-16b7b43f5a8f@acm.org> <20210524084345epcms2p63dde85f3fdc127c29d25ada7d7f539cb@epcms2p6> <20210524084546epcms2p2c91dc1df482fd593307892825532c6dd@epcms2p2> <20210604011124epcms2p39a466db169ebbfd2c889e25fba9aa0b4@epcms2p3> From: Bart Van Assche Message-ID: <4bf317c8-4c74-2207-95e2-34c59b14c454@acm.org> Date: Thu, 3 Jun 2021 19:54:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210604011124epcms2p39a466db169ebbfd2c889e25fba9aa0b4@epcms2p3> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/3/21 6:11 PM, Daejun Park wrote: >>> +/* >>> + * This function will set up HPB read command using host-side L2P map data. >>> + * In HPB v1.0, maximum size of HPB read command is 4KB. >>> + */ >>> +void ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) >>> +{ >> [ ... ] >>> + >>> + ufshpb_set_hpb_read_to_upiu(hpb, lrbp, lpn, ppn, transfer_len); >> >> 'transfer_len' has type int and is truncated to type 'u8' when passed as >> an argument to ufshpb_set_hpb_read_to_upiu(). Please handle transfer_len >> values >= 256 properly. > > Before entering the function, ufshpb_is_supported_chunk() checks whether > transfer_len <= hpb->pre_req_max_tr_len which is set to > HPB_MULTI_CHUNK_HIGH (128) on initalization. How about adding a WARN_ON_ONCE() in ufshpb_prep() that verifies that transfer_len is <= HPB_MULTI_CHUNK_HIGH? Thanks, Bart.