From patchwork Sun Feb 5 01:57:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9555833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AF7E760236 for ; Sun, 5 Feb 2017 01:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F66A269DA for ; Sun, 5 Feb 2017 01:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93ED426E16; Sun, 5 Feb 2017 01:57:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AD43269DA for ; Sun, 5 Feb 2017 01:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751491AbdBEB5y (ORCPT ); Sat, 4 Feb 2017 20:57:54 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33147 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbdBEB5x (ORCPT ); Sat, 4 Feb 2017 20:57:53 -0500 Received: by mail-io0-f194.google.com with SMTP id 101so5991676iom.0 for ; Sat, 04 Feb 2017 17:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=tuj9avWRQDFdz2FOg1wuWdnt7dRQkqUkZ2dwHaaQB1M=; b=nytOoMOuPXtK1X2+8fUuWvrGAhKCDY7y+UIJwqyG792QmWtcRSUWxmMjcIEXu3psPr qVBt13w1pcaRfaJM5wC+Sg+Wz9jyQu3O+I2Hdsh82MXB6PvJL1y7eR+grGiDSGpojKWp TzXCdTQByVTF4z6/zAGUyWDpfkhNeA0+JwzsZRQ1r6CQStAlXp+bJJQRtPn6lsm4YMXE amclc+yUFjo4GItst/ERmRpXKq/Epvux5rL3wshSCpseEi74mSHfxRhSUBo3h68GgnNA /+3aS9wVOs/YE6rh3ZNJPW4PzkyiT5Q6R+RHr/fkt242C/VzVN1yMqGc3adNRa2+tlh1 o+qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=tuj9avWRQDFdz2FOg1wuWdnt7dRQkqUkZ2dwHaaQB1M=; b=JmnJibCmOtHufD65WQ/TNn7cR6Fs1UOcLmVt3zePW2MjS/CktMdu479X0OryiMvN8v E5JwBKahGzGMuDQ7SGDfotI7NjbwpGsTM8WAHB4o32UJwA/nErWYmF04xEShv/8y2hq2 VLkz+JzqhHb/3z5AvB4GLd3BRUKF81Avq5GTN6z8Te4ipjvjjRtYUJ6C085AckUc8ex+ oYsagpQOmqvupJVaR1zlzkBARl2UXg6N51KBeIdPg5pBbg02TcKK7FRvT308wu3A9Kyd C5ce2noDf2yYiLqvjB/qX8v79GVzJVS0X2TWLD4tLyP9BBhveKN0jWYT3UOuKz0gLyJu ECXg== X-Gm-Message-State: AMke39mFmbRla/cpKKkk8/J0V659CX/eF5zIaANDWTXKci9kl/uuwYJjxFGIeYYfTRP+Uw== X-Received: by 10.107.148.141 with SMTP id w135mr3054135iod.229.1486259872672; Sat, 04 Feb 2017 17:57:52 -0800 (PST) Received: from [192.168.0.107] ([182.139.117.200]) by smtp.gmail.com with ESMTPSA id u63sm1841746ita.1.2017.02.04.17.57.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Feb 2017 17:57:52 -0800 (PST) From: Kinglong Mee Subject: [PATCH 3/3] nfsd/callback: Drop an useless data copy when comparing sessionid To: "J. Bruce Fields" , linux-nfs@vger.kernel.org Cc: Kinglong Mee Message-ID: Date: Sun, 5 Feb 2017 09:57:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4callback.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index ea74149..0274db6 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -397,13 +397,10 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr, struct nfsd4_callback *cb) { struct nfsd4_session *session = cb->cb_clp->cl_cb_session; - struct nfs4_sessionid id; - int status; + int status = -ESERVERFAULT; __be32 *p; u32 dummy; - status = -ESERVERFAULT; - /* * If the server returns different values for sessionID, slotID or * sequence number, the server is looney tunes. @@ -411,9 +408,8 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr, p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4); if (unlikely(p == NULL)) goto out_overflow; - memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN); - if (memcmp(id.data, session->se_sessionid.data, - NFS4_MAX_SESSIONID_LEN) != 0) { + + if (memcmp(p, session->se_sessionid.data, NFS4_MAX_SESSIONID_LEN)) { dprintk("NFS: %s Invalid session id\n", __func__); goto out; }