From patchwork Fri May 26 14:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13256963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D41BC7EE23 for ; Fri, 26 May 2023 14:31:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DCB96B0080; Fri, 26 May 2023 10:31:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28C1D6B0081; Fri, 26 May 2023 10:31:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 153756B0082; Fri, 26 May 2023 10:31:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 072A86B0080 for ; Fri, 26 May 2023 10:31:47 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D0FBBA013C for ; Fri, 26 May 2023 14:31:46 +0000 (UTC) X-FDA: 80832645012.25.8E2F508 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 193332003B for ; Fri, 26 May 2023 14:31:42 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gyWfqspA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685111503; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CKSB6Rx2bx1fJ9JqD5rxOprNdt4epz1O6h3wMG9pSn8=; b=ZEFOE7/2wBSpS4z0YYdBDwjikrupJgYSdwKt+0AEyA66tHNnwf8H4MErOjySQdX128xW6r x29LJenfUlc68tPSJlDvgRevBul4ABe1805HPVEtxwVrv4ODWgKJ0Bdp20EQ4Xh+9sWMOl WhMpZjRPZXOwGfrCPNt9zMbZny/F7BU= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gyWfqspA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685111503; a=rsa-sha256; cv=none; b=BQWrwFeNvJmVhLZAcLKpUGmKq2M1ygBpoDEVIXrm1fT5Bsm/2oe5IU9T/Bl8YyYBazTerw AHQiIozmY44VCmPvRPtMxo7YKPNDBnok3KN7V2JFtqPWxVm3SIXTep2hdYzOwM46ZVRylv LmEjA1gOcm3aOy0hfCbhW++AbCjeFXk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685111502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CKSB6Rx2bx1fJ9JqD5rxOprNdt4epz1O6h3wMG9pSn8=; b=gyWfqspAL2ukHovRqjqfYBKvjbjf4Z5NXpE7tGcOUhBhgNT12RmRqg7riY+ZYCoZB8OcPr 4YAFUHsc45EaxRWXOVLCKA7SEVVKQWYdRK7LWrnoQRcVORqwF+OEW/5it30o2P+xv7T2GD QKqvJgRNr/YVbSEYw6LSp1gDSgR6hnQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-25-jLnS6QVHOfGVhUBPQMxYFw-1; Fri, 26 May 2023 10:31:25 -0400 X-MC-Unique: jLnS6QVHOfGVhUBPQMxYFw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AC7B3855561; Fri, 26 May 2023 14:31:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25EEC140E95D; Fri, 26 May 2023 14:31:23 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-crypto@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/8] crypto: af_alg: Indent the loop in af_alg_sendmsg() Date: Fri, 26 May 2023 15:31:01 +0100 Message-Id: <20230526143104.882842-6-dhowells@redhat.com> In-Reply-To: <20230526143104.882842-1-dhowells@redhat.com> References: <20230526143104.882842-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 193332003B X-Stat-Signature: oyxme9f8nz6g8n68sdzzrrsahc3ktwk1 X-HE-Tag: 1685111502-618092 X-HE-Meta: U2FsdGVkX1/ItfhiPDYV5pzCnSdH1ZU3AGuOxRydvayMy1k/911S+scYvR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6WG7OvUvvOY9/JydbBXH6B68D4phWg6AtlAiLK7iaRL4KABK1mYBfCaTUmuxr/xmZrt/cWxS9m1OB/CMLLsoiS1iUdO5bWMtNry+zmOY3y7o523VfEA3gVu7+ZE0sZaQNvnSD1cahMpbYfpFbebaycDoJ7PQCpnNxLF/P/U8MexWNtatnnVSdMidSe7CNi8jya8pyvETe121YvoueD0KOzoabJI8jD7eE42HEAhq2qyvgV2/Y8XuI3vJ2MhWByDrwJ7gHW909UywJq8DtNNWNUetvnbU8H1b5gDkiQ2mvtI6IA/rL+uzkrIFRiwkPsKFhpVNZV1kVCe0lc01TygratiX82HRxTX59vNw1jRKhynAabIyPhcRCQkzT3DOJkNZI7x3fw3+3eLxBaub5FDJjYilQlgWjAh+GTkck0Hvw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Put the loop in af_alg_sendmsg() into an if-statement to indent it to make the next patch easier to review as that will add another branch to handle MSG_SPLICE_PAGES to the if-statement. Signed-off-by: David Howells cc: Herbert Xu cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: linux-crypto@vger.kernel.org cc: netdev@vger.kernel.org --- crypto/af_alg.c | 50 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 8a35f1364ac3..17ecaae50af7 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -1030,35 +1030,37 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, if (sgl->cur) sg_unmark_end(sg + sgl->cur - 1); - do { - struct page *pg; - unsigned int i = sgl->cur; + if (1 /* TODO check MSG_SPLICE_PAGES */) { + do { + struct page *pg; + unsigned int i = sgl->cur; - plen = min_t(size_t, len, PAGE_SIZE); + plen = min_t(size_t, len, PAGE_SIZE); - pg = alloc_page(GFP_KERNEL); - if (!pg) { - err = -ENOMEM; - goto unlock; - } + pg = alloc_page(GFP_KERNEL); + if (!pg) { + err = -ENOMEM; + goto unlock; + } - sg_assign_page(sg + i, pg); + sg_assign_page(sg + i, pg); - err = memcpy_from_msg(page_address(sg_page(sg + i)), - msg, plen); - if (err) { - __free_page(sg_page(sg + i)); - sg_assign_page(sg + i, NULL); - goto unlock; - } + err = memcpy_from_msg(page_address(sg_page(sg + i)), + msg, plen); + if (err) { + __free_page(sg_page(sg + i)); + sg_assign_page(sg + i, NULL); + goto unlock; + } - sg[i].length = plen; - len -= plen; - ctx->used += plen; - copied += plen; - size -= plen; - sgl->cur++; - } while (len && sgl->cur < MAX_SGL_ENTS); + sg[i].length = plen; + len -= plen; + ctx->used += plen; + copied += plen; + size -= plen; + sgl->cur++; + } while (len && sgl->cur < MAX_SGL_ENTS); + } if (!size) sg_mark_end(sg + sgl->cur - 1);