From patchwork Tue May 23 01:14:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9741709 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 874A260210 for ; Tue, 23 May 2017 01:14:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70BD32877B for ; Tue, 23 May 2017 01:14:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 631C42877F; Tue, 23 May 2017 01:14:43 +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 EF1562877B for ; Tue, 23 May 2017 01:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758238AbdEWBOm (ORCPT ); Mon, 22 May 2017 21:14:42 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36028 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757760AbdEWBOl (ORCPT ); Mon, 22 May 2017 21:14:41 -0400 Received: by mail-pf0-f193.google.com with SMTP id n23so23585020pfb.3 for ; Mon, 22 May 2017 18:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=s6B3pU4szNvy9n2C93SuS8PaKPG+UXuB5CaUmDc6Lgg=; b=WCNqvTqYebNa2tjmMolUPmU+vp3bWa6sL5oi7BFLW/9/OMDe8ot70R1FuwQDSIUF0a 2M2nfYfles5BN6cQapkQ4XhFrv8Tc6mCI+xQpNC+HWRoPVNoU44sgWDFqV3MPkDkfNBB 79mxmXI/+ZQliloZrEVfEuqpAoOWZ+pKxeLoyri6r79iPDykVmvY8E4emSKdYnXfcj7j VfaWYFYSXIPhXHLFyzgI5xk7wfkWTNcfj7SpVbGQ3XQzGkdShX1Gu0hxaVawISOjCkWy TePX0RyK0PRsxos/F4wZrlGVdRl0wzlT6f9ri+93eluxeIoDIpFcDOtY/Yw0RNu/28N2 6MNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=s6B3pU4szNvy9n2C93SuS8PaKPG+UXuB5CaUmDc6Lgg=; b=kKtk3/ej5pGxMpQvQYAFOyhjlJPcJgkbudQ7euL66cSaUhuY70bbk8p/JHJXpWNYtC G2TmtQir4QBK5wA7PfVJ/IlkottbeZHr3xKcTdQLoO4YO3sQ6QHaIHx2VJoLlSCkNApo FTokH99QIqtKj2+7qzJ9ICSFxCEXa8OExgUOfLRiXj4qUbREJccrP3hRXzE2xy06WoLB BRJtqlNnQ4NvjEOd2vhePKjWLGGjPemr4O7zd+EKP57jRJ/ruY9BG0B3/bX/UP70Zctb btMUjrX5ckkyOuMYWiGVt05Bqh2iCSMtBohqoYMMNNJTfwzkIFPZJHiAj4tqSNqIzvBp vD5Q== X-Gm-Message-State: AODbwcDN+hTDuLu7BpDXJl9Bn+ydaSIT66X2Fg7yNw0viNIj+4UQi+V8 dkt/m85fawZrKsDGJZM= X-Received: by 10.98.19.206 with SMTP id 75mr28639253pft.208.1495502080935; Mon, 22 May 2017 18:14:40 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.39]) by smtp.gmail.com with ESMTPSA id z68sm32725695pgz.14.2017.05.22.18.14.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 18:14:39 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , Eric Biggers Subject: [PATCH] fscrypt: inline fscrypt_free_filename() Date: Mon, 22 May 2017 18:14:06 -0700 Message-Id: <20170523011406.32718-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.13.0.219.gdb65acc882-goog Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers fscrypt_free_filename() only needs to do a kfree() of crypto_buf.name, which works well as an inline function. We can skip setting the various pointers to NULL, since no user cares about it (the name is always freed just before it goes out of scope). Signed-off-by: Eric Biggers Reviewed-by: David Gstir --- fs/crypto/fname.c | 9 --------- include/linux/fscrypt_supp.h | 7 ++++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index d1bb02b1ee58..ad9f814fdead 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -453,12 +453,3 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, return ret; } EXPORT_SYMBOL(fscrypt_setup_filename); - -void fscrypt_free_filename(struct fscrypt_name *fname) -{ - kfree(fname->crypto_buf.name); - fname->crypto_buf.name = NULL; - fname->usr_fname = NULL; - fname->disk_name.name = NULL; -} -EXPORT_SYMBOL(fscrypt_free_filename); diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h index cd4e82c17304..32e2fcf13b01 100644 --- a/include/linux/fscrypt_supp.h +++ b/include/linux/fscrypt_supp.h @@ -47,7 +47,12 @@ extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *); /* fname.c */ extern int fscrypt_setup_filename(struct inode *, const struct qstr *, int lookup, struct fscrypt_name *); -extern void fscrypt_free_filename(struct fscrypt_name *); + +static inline void fscrypt_free_filename(struct fscrypt_name *fname) +{ + kfree(fname->crypto_buf.name); +} + extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32); extern int fscrypt_fname_alloc_buffer(const struct inode *, u32, struct fscrypt_str *);