Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2517375rwd; Fri, 26 May 2023 07:34:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fgzdO8qujddPFyJcZ20z6XvhO+PDe8W6A7bIrE8YRFXB6Yv2AXBTtG7DdcWvCL8ef2HkC X-Received: by 2002:a05:6a00:1995:b0:64d:277c:77d0 with SMTP id d21-20020a056a00199500b0064d277c77d0mr3906147pfl.22.1685111685666; Fri, 26 May 2023 07:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685111685; cv=none; d=google.com; s=arc-20160816; b=rJBXCPj9knwXnbiUqEFt9vmbe0lqyjqCYaGaRA5HiumODBmQOqesVvsnyWRlGh6Jm2 VMxccDkiZFDQL6djtR4q2jQpSAdzu4+xaQNLl1NjgmjHqR3QRN5Hlu1lCCWfPwkpoUQ9 VgT6/tR32/UTrjpr8m9E9+5plPg03+fb2w1UYiOl5Klh4undzIjkbzYa/uoEHISUOFQm /kL6jipd4mEypMnkLNvVOKjPJ1L9SDo3pWkXZcHRz1GxAoj+OwtaimxOYIHBKxJANgDh azHNLA1Nx03kVx2Ep7FlUQuLCNlS36O6D5LciXqyOGDLVC6yvQIOk2EH1+4u9TOCFZ8g 6U+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CKSB6Rx2bx1fJ9JqD5rxOprNdt4epz1O6h3wMG9pSn8=; b=LJYWjeukN80nOdrXd7j8egx2GynBa18Iy7PPhNYVWLIAcayfZSDZi9pObN1lQVdaOD INUPAp0W6uHf4JAo4gFr2xr4qXboErDR2dwNzyS/adDm2eIXYme6BNztPWoVQeJBxzR3 bKK3zSSYkR9sIbBchamkMVqJK+KUahJQ4FA7y54WslnEjTHp/jKRIge2i7bIzAxIfGUT Eit7ADLj0Qvak2QUBhb3RPGWnB91eB5GXKLwV0adDISyKHDRPgbtE38OLT27yQArjAqu Id9IwqVr4LwCjzY42BApREVr77KyeVLtrCM1Ei3CsbeFz6ImBQ1McMIYc3B+s8gviObc o00Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P3L28453; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a637558000000b0053f28ed4d3bsi3842362pgn.30.2023.05.26.07.34.30; Fri, 26 May 2023 07:34:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P3L28453; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243734AbjEZOdD (ORCPT + 99 others); Fri, 26 May 2023 10:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243725AbjEZOca (ORCPT ); Fri, 26 May 2023 10:32:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7449E5D for ; Fri, 26 May 2023 07:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685111496; 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=P3L28453IUY2jhuHUPHTVFgs5xi8AWH1ymTbDkNchba9G8G2SseO0EPKeUO0jHves6+Quu nIiXc7ancwwXgXJyYyUJLJq0aVJnBuVQytNcul69YJ0Lm2vaQGVY40Koha6M6LLgGZM8uK q29okbeg9acldVMhOaZr7I7ksou8oC4= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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);