From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753653AbbFAQ37 (ORCPT ); Mon, 1 Jun 2015 12:29:59 -0400 Received: from mail-bl2on0114.outbound.protection.outlook.com ([65.55.169.114]:6028 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752635AbbFAQ3w (ORCPT ); Mon, 1 Jun 2015 12:29:52 -0400 X-Greylist: delayed 839 seconds by postgrey-1.27 at vger.kernel.org; Mon, 01 Jun 2015 12:29:52 EDT Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; davemloft.net; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NP9X5J-08-BTV-02 X-M-MSG: Subject: [PATCH v1 0/2] scatterlist: introduce sg_nents_for_len From: Tom Lendacky To: CC: David Miller , , Herbert Xu Date: Mon, 1 Jun 2015 11:15:19 -0500 Message-ID: <20150601161519.729.75909.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD023;1:NrM9wUHXewfiRrsVq98DxsdsYstfQabufDgDAUMj5ifDRsI+so7GfM6BhafAZHzhDTFAlIpXuxtT/BJjC7YGqakwZWR+/tEEChx+14+0QAgN/ab9OAF4H8Yn60Bs8DoKG/GSrOs/WwDL1Erl5CpzLNAnmdXf7WqHntr+F+NJR1xsU0y6hdJbSmhJs8m3DPoHBPBBXtQWS0rzdgGdvt+4rqt4bFuP4pywjwsxRzjZsCijZTn75Cn4VbUseUBgJvG+/ChpszJt8siYoC3S1TCDtvjHsZYycuL7rZ1DvquQj3VaVv+cz1SbqhylczZitnHu X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(189002)(199003)(105586002)(77096005)(46102003)(229853001)(97746001)(33646002)(54356999)(4001350100001)(62966003)(50466002)(4001540100001)(77156002)(87936001)(2351001)(47776003)(23676002)(5001860100001)(106466001)(97736004)(5001830100001)(50986999)(86362001)(68736005)(189998001)(64706001)(110136002)(53416004)(92566002)(101416001)(83506001)(103116003)(71626006);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR02MB079;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB079; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:CO1PR02MB079;BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB079; X-Forefront-PRVS: 05947791E4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2015 16:15:21.2661 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB079 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series introduces and makes use of a new scatterlist function named sg_nents_for_len. The purpose of this function is determine the number of scatterlist entries required to satisify a specified length. The resulting count can be used as input to the dma_map_sg function to map only the entries needed. This function is needed for cases where a supplied scatterlist has not marked the last filled sg entry as the end of the scatterlist. In these cases, the sg_nents function count includes sg entries that may not have been filled in. When using this value in a dma_map_sg call it can result in errors/bugs being generated. The following patches are included in this series: - Introduce the sg_nents_for_len function - Update the ccp driver to use the sg_nents_for_len function This patch series is based on cryptodev-2.6. --- Tom Lendacky (2): scatterlist: introduce sg_nents_for_len crypto: ccp - Protect against poorly marked end of sg list drivers/crypto/ccp/ccp-ops.c | 7 +++++-- include/linux/scatterlist.h | 1 + lib/scatterlist.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) -- Tom Lendacky