From patchwork Tue May 30 14:16:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13260170 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 F0D84C77B73 for ; Tue, 30 May 2023 14:17:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CA006B0078; Tue, 30 May 2023 10:17:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87954280005; Tue, 30 May 2023 10:17:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71B36280004; Tue, 30 May 2023 10:17:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 650876B0078 for ; Tue, 30 May 2023 10:17:46 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7EE55160305 for ; Tue, 30 May 2023 14:17:44 +0000 (UTC) X-FDA: 80847124848.21.FFFA71B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id B7B074000C for ; Tue, 30 May 2023 14:17:42 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CRUr25O+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1685456262; 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=jD4W/W7iXB9ATeRl2QuO5GnCDoE2m4ZXOMCYUAgCXGY=; b=SzH2PtWJFKNkvT8z6OraQOPKvrggPONNu6qr9jm7X3UJ5WjRCOtuEav15P/roN0uZIXQdK qDgkWd0cw8lEOIFxr2rTL5PFfBF5VPWVryNszglidTSTihZlPs3th8c168PvWMclLVD/7x IwdU/ePyQOPw5szOBIz1Aw8llD9NAHw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CRUr25O+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685456262; a=rsa-sha256; cv=none; b=DvlP5iC+SXY4kBQAPCEGz8FWLaAHbHF7RvXW4MNl+qEyFUhcVP9X41FA/RGgFs6/QearLF 9HCOvIBKg8YvCSXq2wm4+QqT+Pyvl8xiJF9VOjMF80EI7tSRxPVoEE/vlC2HwMzvpwl3c3 UxvnjM8A8D1IPo+y8MVOE+yYfpNpmd8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685456262; 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=jD4W/W7iXB9ATeRl2QuO5GnCDoE2m4ZXOMCYUAgCXGY=; b=CRUr25O+VIQorY2X3X6Y2X8zeHPZgPlvzwEoDCDtczyDq7FFqT7GxSYHQF3ptVlufXfFGh +PBn8pF8zP5Ow/SSBYjmllc5ov2FWhsoMxRiHrHup53hKWoZtzNGrupm+J6NCuea6C012e 9MVwCue2jO8ePd9RnoEzuFGZz4jDTdQ= 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-210-n8AGTfiBPVSP1SnUgycr9w-1; Tue, 30 May 2023 10:17:38 -0400 X-MC-Unique: n8AGTfiBPVSP1SnUgycr9w-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 EF71E38154EB; Tue, 30 May 2023 14:17:37 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id A08D1140E955; Tue, 30 May 2023 14:17:35 +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 v2 07/10] crypto: af_alg: Indent the loop in af_alg_sendmsg() Date: Tue, 30 May 2023 15:16:31 +0100 Message-ID: <20230530141635.136968-8-dhowells@redhat.com> In-Reply-To: <20230530141635.136968-1-dhowells@redhat.com> References: <20230530141635.136968-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Rspamd-Queue-Id: B7B074000C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: chibu3o4br38hcwf7uz9rrn8fz31cdxs X-HE-Tag: 1685456262-508373 X-HE-Meta: U2FsdGVkX1+jwLv8+ZD5YbWWJt89wEXUOeTcbWWmBkrC6xiAyOLa1mo+gEoFJEMvCNa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sPmqzxQjjB0nDbF+b92pL6hCziz23Peb2vLeXfGDTuRvqnIRqfTtlWlU9WVn79rxzttlMYhsk4Rj1jC+NvKktQO7MdSBDDn9ZgbB9rhKVMRQOb4JtCL1/hS+sa0Hkb/jsgLojsxUEAUTy+N3ggBe5GtZ4Np1stKCcPSHhmTWYjD99cOA4vYF379sb+BY2Tl06Vi3I37eVnLP0mwojbDnoxxrPiQo3jOnWqverufFpMd9P6rOCiIc4SDK8bOcWQi1CrzAjDyhl5XE3H76Vsm5NRqVbU+pcxMvOhFIGQiiuWepj/Bcj/sPAYQwX+W2tf3Jg3/V4l9y4m4+bS9c3/TakWcOaoZKohxFsqfG/rfXr6EK9ZP3GWvNnvDcCwtCvL8s0AL6QM4sP9Daf7b4XIWZ5hUU= 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 --- Notes: ver #2) - Fix a checkpatch warning. crypto/af_alg.c | 51 ++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index b8bf6d8525ba..fd56ccff6fed 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -1030,35 +1030,38 @@ 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);